I'm a french junior System Adm. and i'm actually trying to build skills in HLASM.
I've coded a little program to retrieve the JCL PARM field and display it in a file, it almost works properly except for the length.
e.g if i code //APIASMX0 EXEC PGM=APIASMX0,PARM='4095'
The display will only be *** PARM = 40 instead of 4095, i only get the first 2 characters of the parm field.
Moreover i get ** ASMA033I Storage alignment for MSGPRM unfavorable at compilation, it's just an informationnal
message but still it bothers me a little.
note : INITL and RCNTL are our standard linkage and exit macro.
Am I missing something obvious ?
*---------------------------------------------------------------------- 00010000
*- PURPOSE : READ JCL PARM FIELD 00020092
*---------------------------------------------------------------------- 00030000
APIREC DSECT 00031038
APICNT DS CL131 BUFFER SYSTEM MAPPING FOR LOCATE MODE 00032099
* 00032199
APIX0 CSECT 00033024
INITL 10,EQU=R BASE REGISTER = 10, R15 = 15 00040039
USING APIREC,R5 ADDRESSAGE POUR DSECT VIA R5 00041099
*---------------------------------------------------------------------- 00050000
* MAIN 00060000
*---------------------------------------------------------------------- 00070000
BAL R6,READPARM RETRIEVE JCL PARM FIELD 00071025
BAL R6,OPENFIC OPEN SYSPRINT FILE 00071199
BAL R6,WRITEFIC WRITE PARM IN SYSPRINT 00071225
BAL R6,CLOSEFIC CLOSE SYSPRINT FILE 00071325
BAL R6,EXITPGM EXIT 00071425
* 00071599
*---------------------------------------------------------------------- 00071699
* READPARM : RETRIEVE JCL PARM 00071799
*---------------------------------------------------------------------- 00071899
READPARM EQU * 00071999
DS 0H 00072099
L R2,0(0,R1) R2 = adr of parm field 00072199
LH R9,0(0,R2) R9 = Length of parm field 00072299
L R3,0(0,R2) R3 = Content of parm field 00072399
ST R3,MSGPRM MSGPRM = content of parm field 00072499
LTR R9,R9 Was parm specified ? 00072599
BZ NOPARM If NO branch to NOPARM 00072699
BR R6 00072799
*---------------------------------------------------------------------- 00072822
* OPENFIC : OPEN SYSPRINT 00072992
*---------------------------------------------------------------------- 00073022
OPENFIC EQU * 00073122
OPEN (APIPRINT,(OUTPUT)) Open sysprint file as output 00073255
BR R6 00073355
* 00073922
*---------------------------------------------------------------------- 00074022
* NOPARM : WRITE ERROR MSG IN SYSPRINT 00074192
*---------------------------------------------------------------------- 00074222
NOPARM EQU * 00074350
BAL R6,OPENFIC 00074499
PUT APIPRINT 00074599
LR R5,R1 00074699
MVC 0(ERRMSG1,R5),ERRMSG 00074799
BAL R6,CLOSEFIC 00074899
RCNTL RC=4 00074999
* 00075022
*---------------------------------------------------------------------- 00075150
* WRITEFIC : WRITE SYSPRINT FILE 00075292
*---------------------------------------------------------------------- 00075350
WRITEFIC EQU * 00075450
PUT APIPRINT 00075550
LR R5,R1 00075699
MVC 0(LLINE1,R5),LINE1 00075799
BR R6 00075850
* 00075950
*---------------------------------------------------------------------- 00076050
* CLOSEFIC : CLOSE SYSPRINT 00076192
*---------------------------------------------------------------------- 00076250
CLOSEFIC EQU * 00076350
CLOSE APIPRINT 00076450
BR R6 00076599
* 00076650
*---------------------------------------------------------------------- 00076750
* EXITPGM : END OF PGM 00076850
*---------------------------------------------------------------------- 00076950
EXITPGM EQU * 00077050
RCNTL RC=0 00077199
* 00077250
*---------------------------------------------------------------------- 00077350
* WORKING STORAGE 00077450
*---------------------------------------------------------------------- 00077550
* 00077650
LINE1 EQU * 00077750
DC C'*** PARM = ' 00077899
MSGPRM DC CL120' ' 00077999
LLINE1 EQU *-LINE1 00078150
* 00078299
ERRMSG EQU * 00078399
DC C'*** RC = 4 NO PARM SPECIFIED' 00078499
DC CL103' ' 00078599
ERRMSG1 EQU *-ERRMSG 00078699
* 00078799
APIPRINT DCB DDNAME=APIPRINT,DSORG=PS,MACRF=(PL), X00078899
RECFM=FB,LRECL=131,BLKSIZE=1310 00078999
END APIX0 00079050
*- PURPOSE : READ JCL PARM FIELD 00020092
*---------------------------------------------------------------------- 00030000
APIREC DSECT 00031038
APICNT DS CL131 BUFFER SYSTEM MAPPING FOR LOCATE MODE 00032099
* 00032199
APIX0 CSECT 00033024
INITL 10,EQU=R BASE REGISTER = 10, R15 = 15 00040039
USING APIREC,R5 ADDRESSAGE POUR DSECT VIA R5 00041099
*---------------------------------------------------------------------- 00050000
* MAIN 00060000
*---------------------------------------------------------------------- 00070000
BAL R6,READPARM RETRIEVE JCL PARM FIELD 00071025
BAL R6,OPENFIC OPEN SYSPRINT FILE 00071199
BAL R6,WRITEFIC WRITE PARM IN SYSPRINT 00071225
BAL R6,CLOSEFIC CLOSE SYSPRINT FILE 00071325
BAL R6,EXITPGM EXIT 00071425
* 00071599
*---------------------------------------------------------------------- 00071699
* READPARM : RETRIEVE JCL PARM 00071799
*---------------------------------------------------------------------- 00071899
READPARM EQU * 00071999
DS 0H 00072099
L R2,0(0,R1) R2 = adr of parm field 00072199
LH R9,0(0,R2) R9 = Length of parm field 00072299
L R3,0(0,R2) R3 = Content of parm field 00072399
ST R3,MSGPRM MSGPRM = content of parm field 00072499
LTR R9,R9 Was parm specified ? 00072599
BZ NOPARM If NO branch to NOPARM 00072699
BR R6 00072799
*---------------------------------------------------------------------- 00072822
* OPENFIC : OPEN SYSPRINT 00072992
*---------------------------------------------------------------------- 00073022
OPENFIC EQU * 00073122
OPEN (APIPRINT,(OUTPUT)) Open sysprint file as output 00073255
BR R6 00073355
* 00073922
*---------------------------------------------------------------------- 00074022
* NOPARM : WRITE ERROR MSG IN SYSPRINT 00074192
*---------------------------------------------------------------------- 00074222
NOPARM EQU * 00074350
BAL R6,OPENFIC 00074499
PUT APIPRINT 00074599
LR R5,R1 00074699
MVC 0(ERRMSG1,R5),ERRMSG 00074799
BAL R6,CLOSEFIC 00074899
RCNTL RC=4 00074999
* 00075022
*---------------------------------------------------------------------- 00075150
* WRITEFIC : WRITE SYSPRINT FILE 00075292
*---------------------------------------------------------------------- 00075350
WRITEFIC EQU * 00075450
PUT APIPRINT 00075550
LR R5,R1 00075699
MVC 0(LLINE1,R5),LINE1 00075799
BR R6 00075850
* 00075950
*---------------------------------------------------------------------- 00076050
* CLOSEFIC : CLOSE SYSPRINT 00076192
*---------------------------------------------------------------------- 00076250
CLOSEFIC EQU * 00076350
CLOSE APIPRINT 00076450
BR R6 00076599
* 00076650
*---------------------------------------------------------------------- 00076750
* EXITPGM : END OF PGM 00076850
*---------------------------------------------------------------------- 00076950
EXITPGM EQU * 00077050
RCNTL RC=0 00077199
* 00077250
*---------------------------------------------------------------------- 00077350
* WORKING STORAGE 00077450
*---------------------------------------------------------------------- 00077550
* 00077650
LINE1 EQU * 00077750
DC C'*** PARM = ' 00077899
MSGPRM DC CL120' ' 00077999
LLINE1 EQU *-LINE1 00078150
* 00078299
ERRMSG EQU * 00078399
DC C'*** RC = 4 NO PARM SPECIFIED' 00078499
DC CL103' ' 00078599
ERRMSG1 EQU *-ERRMSG 00078699
* 00078799
APIPRINT DCB DDNAME=APIPRINT,DSORG=PS,MACRF=(PL), X00078899
RECFM=FB,LRECL=131,BLKSIZE=1310 00078999
END APIX0 00079050