Advertisement
sezenspessa

HLASM month hw

May 10th, 2019
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.29 KB | None | 0 0
  1. //TEST2 JOB 'SEZEN',CLASS=A,NOTIFY=&SYSUID,MSGCLASS=H,
  2. // MSGLEVEL=(1,1)
  3. // EXEC ASMACLG
  4. //C.SYSOUT DD SYSOUT=*
  5. //C.SYSIN DD *
  6. PRINT ON,NODATA,NOGEN I KINDA UNDERSTAND THIS PART
  7. NEW CSECT
  8. STM R14,R12,12(R13)
  9. BASR R12,R0 ESTABLISHING ADDRESSABILITY
  10. USING *,R12
  11. ST R13,SAVE+4 STORING CALLERS REGISTERS
  12. LA R13,SAVE I'M PRETTY SURE
  13. **********************************
  14. * START OF PROGRAM *
  15. **********************************
  16. MAIN OPEN (FILEIN,(INPUT)) OPEN INPUT
  17. OPEN (FILEOUT,(OUTPUT)) OPEN OUTPUT
  18. **********************************
  19. * BEGIN MAIN LOOP!! *
  20. **********************************
  21. LOOP EQU * BEGIN LOOP
  22. * COUNTS EACH CYCLE FOR DEBUG
  23. AP ACC,ONE START ACCUMULATOR
  24. MVC OUTACC,EDWD CONVERTS TO READABLE FORMAT
  25. ED OUTACC,ACC CONVERT PD TO CHARACTER
  26. *** GET FILES AND ASSIGN DATES ***
  27. GET FILEIN,RECIN GET FILE
  28. MVC DATE,RECIN PUT RECORD INTO DATE
  29. MVC DAYOUT,DAY PUT DAY INTO PRINTED FIELD
  30. MVC YEAROUT,YEAR PUT YEAR INTO PRINTED FIELD
  31. *** CONDITIONALS FOR MONTHS *****
  32. CLC MONTH,NDEC IF MONTH > 12 THEN ERROR
  33. BH ERROR
  34. CLC MONTH,NJAN IF MONTH < 01 THEN ERROR
  35. BL ERROR
  36. CLC MONTH,NJAN CONDITIONAL TO ASSIGN MONTH..
  37. BE JAN TO A WORD, CHECKING MONTH
  38. CLC MONTH,NFEB THERES CERTAINLY A BETTER WAY
  39. BE FEB BUT MY KNOWLEDGE IS LIMITED
  40. CLC MONTH,NMAR FOR NOW!
  41. BE MAR
  42. CLC MONTH,NAPR IF MONTH = ##
  43. BE APR
  44. CLC MONTH,NMAY
  45. BE MAY
  46. CLC MONTH,NJUN
  47. BE JUN
  48. CLC MONTH,NJUL
  49. BE JUL
  50. CLC MONTH,NAUG
  51. BE AUG
  52. CLC MONTH,NSEP
  53. BE SEP
  54. CLC MONTH,NOCT
  55. BE OCT
  56. CLC MONTH,NNOV
  57. BE NOV
  58. MVC MONTHOUT,CDEC DEC IS ONLY ONE LEFT
  59. ***** 2ND PART OF LOOP ******* SECOND PART OF LOOP
  60. CONT EQU *
  61. PUT FILEOUT,OUTMSG PRINT OUR MSG
  62. B LOOP BRANCH CAUSE NOT EOF
  63. ********************************
  64. * FINISHING UP, END OF LOOP ** FINISHING UP
  65. ********************************
  66. FINISH EQU *
  67. CLOSE FILEIN CLOSE FILES
  68. CLOSE FILEOUT
  69. ******** EXIT ********
  70. L R13,SAVE+4 RETURN REGISTERS
  71. LM R14,R12,12(R13)
  72. LA R15,0
  73. BR R14 RETURN TO OS
  74. *********************************
  75. * INPUT FILE *
  76. **********************************
  77. FILEIN DCB DSORG=PS,MACRF=(GM),DDNAME=FILEIN,EODAD=FINISH, X
  78. RECFM=FB,LRECL=80
  79. RECIN DS CL80' '
  80. *********************************
  81. * OUTPUT FILE *
  82. *********************************
  83. FILEOUT DCB DSORG=PS,MACRF=(PM),DDNAME=FILEOUT,RECFM=FB,LRECL=80
  84. *********************************
  85. * MONTHS *
  86. *********************************
  87. JAN EQU * ISNT THIS A MESS?
  88. MVC MONTHOUT,CJAN
  89. B CONT
  90. FEB EQU *
  91. MVC MONTHOUT,CFEB MOVING CHARACTER MONTH TO
  92. B CONT OUTPUT.
  93. MAR EQU *
  94. MVC MONTHOUT,CMAR
  95. B CONT
  96. APR EQU *
  97. MVC MONTHOUT,CAPR
  98. B CONT
  99. MAY EQU *
  100. MVC MONTHOUT,CMAY
  101. B CONT
  102. JUN EQU *
  103. MVC MONTHOUT,CJUN
  104. B CONT
  105. JUL EQU *
  106. MVC MONTHOUT,CJUL
  107. B CONT
  108. AUG EQU *
  109. MVC MONTHOUT,CAUG
  110. B CONT
  111. SEP EQU *
  112. MVC MONTHOUT,CSEP
  113. B CONT
  114. OCT EQU *
  115. MVC MONTHOUT,COCT
  116. B CONT
  117. NOV EQU *
  118. MVC MONTHOUT,CNOV
  119. B CONT
  120. *******************************
  121. * ERROR BRANCH *
  122. *******************************
  123. ERROR EQU * SENDING OUR ERROR MESSAGE
  124. PUT FILEOUT,ERRORMSG
  125. B FINISH BRANCH TO END OF PROGRAM
  126. ************************************
  127. * LITERAL POOL (AKA DISASTER ZONE) *
  128. ************************************
  129. LTORG
  130. EDWD DC X'212020' IDK HOW FORMATTING WORKS RLY
  131. ACC DC PL2'0' ACCUMULATOR
  132. ONE DC PL1'1' THE NUMBER ONE
  133. ****** CHARACTER MONTHS ******
  134. CJAN DC C'JAN' MVC = SS INSTRUCTION
  135. CFEB DC C'FEB'
  136. CMAR DC C'MAR'
  137. CAPR DC C'APR'
  138. CMAY DC C'MAY'
  139. CJUN DC C'JUN'
  140. CJUL DC C'JUL'
  141. CAUG DC C'AUG'
  142. CSEP DC C'SEP'
  143. COCT DC C'OCT'
  144. CNOV DC C'NOV'
  145. CDEC DC C'DEC'
  146. ****** NUMBER MONTHS ******
  147. NJAN DC C'01' DECLARING NUMBER OF MONTH
  148. NFEB DC C'02'
  149. NMAR DC C'03'
  150. NAPR DC C'04'
  151. NMAY DC C'05'
  152. NJUN DC C'06'
  153. NJUL DC C'07'
  154. NAUG DC C'08'
  155. NSEP DC C'09'
  156. NOCT DC C'10'
  157. NNOV DC C'11'
  158. NDEC DC C'12'
  159. *****************************
  160. * ERROR MESSAGE *
  161. *****************************
  162. ERRORMSG DS CL80
  163. ORG ERRORMSG
  164. EMSG1 DC CL48'HEY BUDDY, YOU DIDNT PUT A VALID DATE. FIX IT! '
  165. EMSG2 DC CL23'THE PROB IS DATE NUMBER '
  166. OUTACC DS CL10
  167. ORG ,
  168. ****************************
  169. * DATE FORMATTING *
  170. ****************************
  171. DATE DS CL8 SPLIT OUR DATE INTO
  172. ORG DATE SUB-FIELDS
  173. YEAR DS CL4
  174. MONTH DS CL2
  175. DAY DS CL2
  176. ORG , FINISHING THAT
  177. ****************************
  178. * OUR END RESULT MESSAGE *
  179. ****************************
  180. OUTMSG DS CL80 STARTING OUR MSG...
  181. ORG OUTMSG
  182. MSG1 DC C'THE MONTH IS: '
  183. MONTHOUT DS CL3
  184. BLANKS1 DC CL2', '
  185. MSG2 DC C'THE YEAR IS: '
  186. YEAROUT DC CL4' '
  187. BLANKS2 DC CL2', '
  188. MSG3 DC C'THE DAY IS: '
  189. DAYOUT DS CL2
  190. BLANKS DC CL25' '
  191. ORG ,
  192. * OUTPUTS 'THE MONTH IS: ##, THE YEAR IS: ##, THE DAY IS: ##'
  193. *
  194. *************************** DEFINING REGISTERS
  195. * REGISTERS *
  196. ***************************
  197. R0 EQU 0
  198. R6 EQU 6
  199. R5 EQU 5
  200. R12 EQU 12
  201. R13 EQU 13
  202. R14 EQU 14
  203. R15 EQU 15
  204. SAVE DS 18F
  205. END NEW
  206. /*
  207. //G.SYSUDUMP DD SYSOUT=*
  208. //G.FILEOUT DD SYSOUT=*
  209. //SETVAR SET MASTER=&SYSUID..TEST(DATES)
  210. //G.FILEIN DD DSN=&MASTER,DISP=SHR
  211. /*
  212. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement