I need to code a program which get the DSNAME, LRECL and number of record from a file referenced by a DD CARD like CNT*
To perform this task :
First I read the TIOT and on each entry I perform a RDJFCB to get DSNAME
Then a IHADCB to retrieve LRECL and
then a GET to read and count the rows.
I also perform an OBTAIN to read DSCB-1 to test wether the file is a PS (if no I bump to next TIOT entry)
Sometimes it works but other time i get a IEC141I 013-4C on certain file.
Here is the JCL i submit
//APIASMX5 EXEC PGM=APIASMX5
//STEPLIB DD DISP=SHR,DSN=EAPICH.TEST.LOAD
//CNT00001 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUCRF.REC
//CNT00006 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECR.REC
//CNT00002 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUDMD.REC
//CNT00003 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECB.REC
//CNT00004 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECE.REC
//APIFILE DD DISP=OLD,DSN=EAPICH.TD.APIPRINT,
// RECFM=FB,LRECL=131,AVGREC=M,SPACE=(1,(1,1),RLSE)
//STEPLIB DD DISP=SHR,DSN=EAPICH.TEST.LOAD
//CNT00001 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUCRF.REC
//CNT00006 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECR.REC
//CNT00002 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUDMD.REC
//CNT00003 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECB.REC
//CNT00004 DD DISP=SHR,DSN=R$TRF.EXT.AG2R.DUMP01.TAAUECE.REC
//APIFILE DD DISP=OLD,DSN=EAPICH.TD.APIPRINT,
// RECFM=FB,LRECL=131,AVGREC=M,SPACE=(1,(1,1),RLSE)
Here is the code
*
APIREC DSECT 00000605
APICNT DS CL131 00000872
* 00000906
APICOUNT CSECT 00001000
INITL 10,EQU=R BASE REG=10, PREFIX = R 00001100
USING APIREC,R5 ADDRESSAbility for APIREC 00001205
*---------------------------------------------------------------------- 00001300
* MAIN 00001400
*---------------------------------------------------------------------- 00001500
BAL R6,OPEN_FIC OPEN SYSPRINT FILE 00008099
BAL R6,TIOT_R READ TIOT 00008199
BAL R6,CLOS_FIC CLOSE SYSPRINT FILE 00008299
BAL R6,FIN_PGM STANDARD EXIT 00009099
*---------------------------------------------------------------------- 00070000
* OPEN_FIC : 00080075
*---------------------------------------------------------------------- 00090000
OPEN_FIC EQU * 00100075
OPEN (APIFILE,(OUTPUT)) 00100175
BR R6 00100275
* 00100375
*---------------------------------------------------------------------- 00100475
* TIOT_R : 00100575
*---------------------------------------------------------------------- 00100675
TIOT_R EQU * 00100775
LA R2,TIOTADDR R2 = @ OF TIOT 00101099
EXTRACT (R2),FIELDS=TIOT,MF=(E,EXTRACT1) GET TIOT 00102099
L R2,TIOTADDR 00103078
USING TIOT1,R2 00104099
TIOT00IN DS 0H 00105097
CLI TIOELNGH,0 END OF TIOT ? 00106099
BE TIOT0OUT YES, END OF EXECUTION 00107099
MVC TEMPDD,TIOEDDNM TEMPDD = DDNAME 00107199
CLC TEMPDD(3),=C'CNT' IS DDNAME LIKE CNT% 00107699
BE READJFCB YES, WE CONTINUE 00108699
TIOTNEXT DS 0H NO, BUMP TO NEXT ENTRY 00109799
SR R3,R3 R3 = 0 00110299
IC R3,TIOELNGH 00110375
AR R2,R3 NEXT ENTRY 00111099
B TIOT00IN 00113099
TIOT0OUT DS 0H 00115097
DROP R2 00116065
BR R6 00120065
*---------------------------------------------------------------------- 00130075
* SUB-ROUTINE READJFCB : 00140099
*---------------------------------------------------------------------- 00150075
* NOTE : DCBDDNAM-IHADCB+DCBSEQ = OFFSET OF DCNDDNAME FROM DCB 00151099
* DCBSEQ 00152099
*---------------------------------------------------------------------- 00153099
READJFCB DS 0H 00160099
MVC DCBDDNAM-IHADCB+DCBSEQ,TEMPDD MOVE DDNAME IN DCB 00160599
RDJFCB DCBSEQ GET JFCB FROM SWA 00160699
MVC VOLSER,JFCBVOLS GET VOLSER FOR OBTAIN 00160799
OBTAIN CAMLST READ DSCB-1 00160899
LTR R15,R15 IS IT OK ? 00160999
BNZ DSCB_ERR IF KO, EXIT 00161099
MVC MSGNDSN,JFDSN MSGDSN=DSNAME 00161299
CLI DS1DSORG,DS1DSGPS IS DSORG = PS ? 00161399
BNE DSORG_ERR IF NO, BUMP TO NEXT ENTRY 00161499
OPEN (DCBSEQ,(INPUT)),TYPE=J 00161599
USING IHADCB,DCBSEQ 00161699
LH R7,DCBLRECL RETRIEVE LRECL 00161799
MVC NBA,=F'0' COUNT = 0 00161899
READFIC GET DCBSEQ 00161999
L R1,NBA 00162099
LA R1,1(R1) 00162199
ST R1,NBA COUNT = COUNT + 1 00162299
B READFIC 00162399
ENDFIC EQU * 00162499
L R8,NBA ED. COUNT 00162599
LA R4,MSGCOUNT 00162699
CVD R8,PKNBA 00162799
MVC NBAOUT(10),EDNBA 00162899
ED NBAOUT(10),PKNBA+3 00162999
MVC 0(9,R4),NBAOUT+1 00163099
LA R4,MSGLREC ED. LRECL 00163199
CVD R7,PKLREC 00163299
MVC LRECOUT(10),EDLREC 00163399
ED LRECOUT(10),PKLREC+3 00163499
MVC 0(9,R4),LRECOUT+1 00163599
PUT APIFILE 00163699
LR R5,R1 00163799
MVC 0(LLINE1,R5),LINE1 00164099
CLOSE DCBSEQ 00164199
B TIOTNEXT 00164299
* 00164385
*---------------------------------------------------------------------- 00164485
* CLOSEFIC : 00164585
*---------------------------------------------------------------------- 00164685
CLOS_FIC EQU * 00165099
CLOSE APIFILE 00170099
BR R6 00180099
* 00520000
*---------------------------------------------------------------------- 00521099
* FIN_PGM : 00522099
*---------------------------------------------------------------------- 00523099
FIN_PGM EQU * 00524099
RCNTL RC=0 00525099
* 00526099
*---------------------------------------------------------------------- 00528099
* DSCB_ERR: DSBC-1 KO 00529099
*---------------------------------------------------------------------- 00529199
DSCB_ERR EQU * 00529299
MVC MSGERR,MYERR1 00529399
MVC ERRDSN,JFDSN MSGDSN=NOM DU FICHIER 00529499
PUT APIFILE ADRESSE DU BUFFER DISPO. DANS R1 00529599
LR R5,R1 SGV DU R1 EN R5 00529699
MVC 0(LLINEX,R5),LINEX 00529799
B TIOTNEXT 00529899
* 00529999
* 00530099
*---------------------------------------------------------------------- 00530199
* DSORG_ERR: DSORG <> PS 00530299
*---------------------------------------------------------------------- 00530399
DSORG_ERR EQU * 00530499
MVC MSGERR,MYERR2 ERRDSN=NOM DU FICHIER 00530599
MVC ERRDSN,JFDSN MSGDSN=NOM DU FICHIER 00530699
PUT APIFILE ADRESSE DU BUFFER DISPO. DANS R1 00530799
LR R5,R1 SGV DU R1 EN R5 00530899
MVC 0(LLINEX,R5),LINEX 00530999
B TIOTNEXT 00531099
* 00531299
*---------------------------------------------------------------------- 00532099
* WORKING STORAGE 00540000
* NOTE : 00540199
*---------------------------------------------------------------------- 00550000
DS 0D ALIGNEMENT REQUIS POUR OBTAIN 00620299
CAMLST CAMLST SEARCH,JFCB1,VOLSER,DSCB TO READ THE FORMAT 1 DSCB 00620399
DSCB DS 265C DSECT DU DSCB DE FORMAT 1 00620499
PRINT OFF 00620599
ORG DSCB-44 00620699
IECSDSL1 (1) 00620799
PRINT ON 00620899
ORG 00620999
VOLSER DC CL6' ' VOLSER FOR OBTAIN 00621199
* 00621299
DS 0D ALIGNEMENT REQUIS POUR JFCB 00621399
EXLIST DC X'87' 00621499
DC AL3(JFCB1) 00621599
JFCB1 DS 0CL176 DSECT DU JFCB 00621699
JFDSN DS CL44 DATA SET NAME 00621799
ORG JFCB1 00621999
PRINT OFF 00622099
IEFJFCBN 00622199
PRINT ON 00622299
ORG 00622399
* 00622499
DCBSEQ DCB DDNAME=DUMMY,DSORG=PS,MACRF=(GL),EXLST=EXLIST,EODAD=ENDFIC 00622599
APIFILE DCB DDNAME=APIFILE,DSORG=PS,MACRF=(PL), X00622699
RECFM=FB,LRECL=131,BLKSIZE=1310 00622799
* 00622899
TEMPDD DC CL8' ' 00622999
* 00623099
PKNBA DS 1D EDITITION COMPTEUR 00623199
EDNBA DC X'40',7X'20',X'21',X'20' 00623299
NBAOUT DS CL10 00623399
* 00623499
PKLREC DS 1D EDITION LONGUEUR 00623599
EDLREC DC X'40',7X'20',X'21',X'20' 00623699
LRECOUT DS CL10 00623799
* 00623899
NBA DS 1F NOMBRE D'ENREG 00624099
* 00625099
EXTRACT1 EXTRACT ,,MF=L 00721499
TIOTADDR DC F'0' 00721599
* 00721699
LINE1 EQU * 00721799
MSGNDSN DC CL44' ' 00721899
DC C';' 00721999
MSGLREC DC C'AAAAAAAAA' 00722099
DC C';' 00722199
MSGCOUNT DC C'AAAAAAAAA' 00722299
DC C';' 00722399
LLINE1 EQU *-LINE1 00722499
* 00722599
LINEX EQU * 00722699
MSGERR DC CL41' ' 00722799
ERRDSN DS CL44' ' 00722899
LLINEX EQU *-LINEX 00723399
MYERR1 DC C'-- LECTURE DU DSCB-1 KO POUR FICHIER : ' 00723799
MYERR2 DC C'-- DSORG <> PS POUR FICHIER : ' 00723899
* 00723999
PRINT OFF 00724099
DCBD DSORG=PS DSECT DU DCB 00724199
PRINT ON 00724299
* 00724399
TIOT DSECT 00724499
PRINT OFF 00724599
IEFTIOT1 00724699
PRINT ON 00724799
* 00725089
END APICOUNT 00730000
APIREC DSECT 00000605
APICNT DS CL131 00000872
* 00000906
APICOUNT CSECT 00001000
INITL 10,EQU=R BASE REG=10, PREFIX = R 00001100
USING APIREC,R5 ADDRESSAbility for APIREC 00001205
*---------------------------------------------------------------------- 00001300
* MAIN 00001400
*---------------------------------------------------------------------- 00001500
BAL R6,OPEN_FIC OPEN SYSPRINT FILE 00008099
BAL R6,TIOT_R READ TIOT 00008199
BAL R6,CLOS_FIC CLOSE SYSPRINT FILE 00008299
BAL R6,FIN_PGM STANDARD EXIT 00009099
*---------------------------------------------------------------------- 00070000
* OPEN_FIC : 00080075
*---------------------------------------------------------------------- 00090000
OPEN_FIC EQU * 00100075
OPEN (APIFILE,(OUTPUT)) 00100175
BR R6 00100275
* 00100375
*---------------------------------------------------------------------- 00100475
* TIOT_R : 00100575
*---------------------------------------------------------------------- 00100675
TIOT_R EQU * 00100775
LA R2,TIOTADDR R2 = @ OF TIOT 00101099
EXTRACT (R2),FIELDS=TIOT,MF=(E,EXTRACT1) GET TIOT 00102099
L R2,TIOTADDR 00103078
USING TIOT1,R2 00104099
TIOT00IN DS 0H 00105097
CLI TIOELNGH,0 END OF TIOT ? 00106099
BE TIOT0OUT YES, END OF EXECUTION 00107099
MVC TEMPDD,TIOEDDNM TEMPDD = DDNAME 00107199
CLC TEMPDD(3),=C'CNT' IS DDNAME LIKE CNT% 00107699
BE READJFCB YES, WE CONTINUE 00108699
TIOTNEXT DS 0H NO, BUMP TO NEXT ENTRY 00109799
SR R3,R3 R3 = 0 00110299
IC R3,TIOELNGH 00110375
AR R2,R3 NEXT ENTRY 00111099
B TIOT00IN 00113099
TIOT0OUT DS 0H 00115097
DROP R2 00116065
BR R6 00120065
*---------------------------------------------------------------------- 00130075
* SUB-ROUTINE READJFCB : 00140099
*---------------------------------------------------------------------- 00150075
* NOTE : DCBDDNAM-IHADCB+DCBSEQ = OFFSET OF DCNDDNAME FROM DCB 00151099
* DCBSEQ 00152099
*---------------------------------------------------------------------- 00153099
READJFCB DS 0H 00160099
MVC DCBDDNAM-IHADCB+DCBSEQ,TEMPDD MOVE DDNAME IN DCB 00160599
RDJFCB DCBSEQ GET JFCB FROM SWA 00160699
MVC VOLSER,JFCBVOLS GET VOLSER FOR OBTAIN 00160799
OBTAIN CAMLST READ DSCB-1 00160899
LTR R15,R15 IS IT OK ? 00160999
BNZ DSCB_ERR IF KO, EXIT 00161099
MVC MSGNDSN,JFDSN MSGDSN=DSNAME 00161299
CLI DS1DSORG,DS1DSGPS IS DSORG = PS ? 00161399
BNE DSORG_ERR IF NO, BUMP TO NEXT ENTRY 00161499
OPEN (DCBSEQ,(INPUT)),TYPE=J 00161599
USING IHADCB,DCBSEQ 00161699
LH R7,DCBLRECL RETRIEVE LRECL 00161799
MVC NBA,=F'0' COUNT = 0 00161899
READFIC GET DCBSEQ 00161999
L R1,NBA 00162099
LA R1,1(R1) 00162199
ST R1,NBA COUNT = COUNT + 1 00162299
B READFIC 00162399
ENDFIC EQU * 00162499
L R8,NBA ED. COUNT 00162599
LA R4,MSGCOUNT 00162699
CVD R8,PKNBA 00162799
MVC NBAOUT(10),EDNBA 00162899
ED NBAOUT(10),PKNBA+3 00162999
MVC 0(9,R4),NBAOUT+1 00163099
LA R4,MSGLREC ED. LRECL 00163199
CVD R7,PKLREC 00163299
MVC LRECOUT(10),EDLREC 00163399
ED LRECOUT(10),PKLREC+3 00163499
MVC 0(9,R4),LRECOUT+1 00163599
PUT APIFILE 00163699
LR R5,R1 00163799
MVC 0(LLINE1,R5),LINE1 00164099
CLOSE DCBSEQ 00164199
B TIOTNEXT 00164299
* 00164385
*---------------------------------------------------------------------- 00164485
* CLOSEFIC : 00164585
*---------------------------------------------------------------------- 00164685
CLOS_FIC EQU * 00165099
CLOSE APIFILE 00170099
BR R6 00180099
* 00520000
*---------------------------------------------------------------------- 00521099
* FIN_PGM : 00522099
*---------------------------------------------------------------------- 00523099
FIN_PGM EQU * 00524099
RCNTL RC=0 00525099
* 00526099
*---------------------------------------------------------------------- 00528099
* DSCB_ERR: DSBC-1 KO 00529099
*---------------------------------------------------------------------- 00529199
DSCB_ERR EQU * 00529299
MVC MSGERR,MYERR1 00529399
MVC ERRDSN,JFDSN MSGDSN=NOM DU FICHIER 00529499
PUT APIFILE ADRESSE DU BUFFER DISPO. DANS R1 00529599
LR R5,R1 SGV DU R1 EN R5 00529699
MVC 0(LLINEX,R5),LINEX 00529799
B TIOTNEXT 00529899
* 00529999
* 00530099
*---------------------------------------------------------------------- 00530199
* DSORG_ERR: DSORG <> PS 00530299
*---------------------------------------------------------------------- 00530399
DSORG_ERR EQU * 00530499
MVC MSGERR,MYERR2 ERRDSN=NOM DU FICHIER 00530599
MVC ERRDSN,JFDSN MSGDSN=NOM DU FICHIER 00530699
PUT APIFILE ADRESSE DU BUFFER DISPO. DANS R1 00530799
LR R5,R1 SGV DU R1 EN R5 00530899
MVC 0(LLINEX,R5),LINEX 00530999
B TIOTNEXT 00531099
* 00531299
*---------------------------------------------------------------------- 00532099
* WORKING STORAGE 00540000
* NOTE : 00540199
*---------------------------------------------------------------------- 00550000
DS 0D ALIGNEMENT REQUIS POUR OBTAIN 00620299
CAMLST CAMLST SEARCH,JFCB1,VOLSER,DSCB TO READ THE FORMAT 1 DSCB 00620399
DSCB DS 265C DSECT DU DSCB DE FORMAT 1 00620499
PRINT OFF 00620599
ORG DSCB-44 00620699
IECSDSL1 (1) 00620799
PRINT ON 00620899
ORG 00620999
VOLSER DC CL6' ' VOLSER FOR OBTAIN 00621199
* 00621299
DS 0D ALIGNEMENT REQUIS POUR JFCB 00621399
EXLIST DC X'87' 00621499
DC AL3(JFCB1) 00621599
JFCB1 DS 0CL176 DSECT DU JFCB 00621699
JFDSN DS CL44 DATA SET NAME 00621799
ORG JFCB1 00621999
PRINT OFF 00622099
IEFJFCBN 00622199
PRINT ON 00622299
ORG 00622399
* 00622499
DCBSEQ DCB DDNAME=DUMMY,DSORG=PS,MACRF=(GL),EXLST=EXLIST,EODAD=ENDFIC 00622599
APIFILE DCB DDNAME=APIFILE,DSORG=PS,MACRF=(PL), X00622699
RECFM=FB,LRECL=131,BLKSIZE=1310 00622799
* 00622899
TEMPDD DC CL8' ' 00622999
* 00623099
PKNBA DS 1D EDITITION COMPTEUR 00623199
EDNBA DC X'40',7X'20',X'21',X'20' 00623299
NBAOUT DS CL10 00623399
* 00623499
PKLREC DS 1D EDITION LONGUEUR 00623599
EDLREC DC X'40',7X'20',X'21',X'20' 00623699
LRECOUT DS CL10 00623799
* 00623899
NBA DS 1F NOMBRE D'ENREG 00624099
* 00625099
EXTRACT1 EXTRACT ,,MF=L 00721499
TIOTADDR DC F'0' 00721599
* 00721699
LINE1 EQU * 00721799
MSGNDSN DC CL44' ' 00721899
DC C';' 00721999
MSGLREC DC C'AAAAAAAAA' 00722099
DC C';' 00722199
MSGCOUNT DC C'AAAAAAAAA' 00722299
DC C';' 00722399
LLINE1 EQU *-LINE1 00722499
* 00722599
LINEX EQU * 00722699
MSGERR DC CL41' ' 00722799
ERRDSN DS CL44' ' 00722899
LLINEX EQU *-LINEX 00723399
MYERR1 DC C'-- LECTURE DU DSCB-1 KO POUR FICHIER : ' 00723799
MYERR2 DC C'-- DSORG <> PS POUR FICHIER : ' 00723899
* 00723999
PRINT OFF 00724099
DCBD DSORG=PS DSECT DU DCB 00724199
PRINT ON 00724299
* 00724399
TIOT DSECT 00724499
PRINT OFF 00724599
IEFTIOT1 00724699
PRINT ON 00724799
* 00725089
END APICOUNT 00730000
and the abend i get
-STEPNAME PROCSTEP RC EXCP CONN TCB SRB CLOCK SERV WORKLOAD PAGE SWAP VIO SWAPS
-ASM ASM 00 171 67 .00 .00 .0 1380 BATCH 0 0 0 0
-ASM LKED 00 54 5 .00 .00 .0 236 BATCH 0 0 0 0
IEC141I 013-4C,IGG0196B,APIASMX5,APIASMX5,CNT00006,4522,COM12B,R$TRF.EXT.TEST.DUMP01.TAAUECR.REC
IEA995I SYMPTOM DUMP OUTPUT 833
SYSTEM COMPLETION CODE=013 REASON CODE=0000004C
TIME=17.20.12 SEQ=33082 CPU=0000 ASID=0043
PSW AT TIME OF ERROR 075C1000 80EAE0CA ILC 2 INTC 0D
NO ACTIVE MODULE FOUND
NAME=UNKNOWN
DATA AT PSW 00EAE0C4 - 41003B9A 0A0D41F0 38C256F0
AR/GR 0: 92F0FF16/00000000_00EAE3AC 1: 00000000/00000000_A4013000
2: 00000000/00000000_00007DF4 3: 00000000/00000000_00EAD812
4: 00000000/00000000_00AC1170 5: 00000000/00000000_00AC1504
6: 00000000/00000000_00AC14AC 7: 00000000/00000000_00AC1504
8: 00000000/00000000_00AC14CC 9: 00000000/00000000_00000000
A: 00000000/00000000_00AD6428 B: 00000000/00000000_00AC106C
C: 00000000/00000000_00007FE7 D: 00000000/00000000_00007FC0
E: 00000000/00000000_80EAD94A F: 00000002/00000010_0000004C
END OF SYMPTOM DUMP
IEF450I APIASMX5 APIASMX5 - ABEND=S013 U0000 REASON=0000004C 834
TIME=17.20.12
-APIASMX5 *S013 13 2 .00 .00 .0 319 BATCH
-ASM ASM 00 171 67 .00 .00 .0 1380 BATCH 0 0 0 0
-ASM LKED 00 54 5 .00 .00 .0 236 BATCH 0 0 0 0
IEC141I 013-4C,IGG0196B,APIASMX5,APIASMX5,CNT00006,4522,COM12B,R$TRF.EXT.TEST.DUMP01.TAAUECR.REC
IEA995I SYMPTOM DUMP OUTPUT 833
SYSTEM COMPLETION CODE=013 REASON CODE=0000004C
TIME=17.20.12 SEQ=33082 CPU=0000 ASID=0043
PSW AT TIME OF ERROR 075C1000 80EAE0CA ILC 2 INTC 0D
NO ACTIVE MODULE FOUND
NAME=UNKNOWN
DATA AT PSW 00EAE0C4 - 41003B9A 0A0D41F0 38C256F0
AR/GR 0: 92F0FF16/00000000_00EAE3AC 1: 00000000/00000000_A4013000
2: 00000000/00000000_00007DF4 3: 00000000/00000000_00EAD812
4: 00000000/00000000_00AC1170 5: 00000000/00000000_00AC1504
6: 00000000/00000000_00AC14AC 7: 00000000/00000000_00AC1504
8: 00000000/00000000_00AC14CC 9: 00000000/00000000_00000000
A: 00000000/00000000_00AD6428 B: 00000000/00000000_00AC106C
C: 00000000/00000000_00007FE7 D: 00000000/00000000_00007FC0
E: 00000000/00000000_80EAD94A F: 00000002/00000010_0000004C
END OF SYMPTOM DUMP
IEF450I APIASMX5 APIASMX5 - ABEND=S013 U0000 REASON=0000004C 834
TIME=17.20.12
-APIASMX5 *S013 13 2 .00 .00 .0 319 BATCH
The file R$TRF.EXT.TEST.DUMP01.TAAUECR.REC effectively resides on unit COM12B it's a PS-E with RECFM=FB - LRECL=239 - BLKSIZE = 32743