1. Read input record received from AS400 in-stream data.
2. Check if it is valid, if yes write to output file else write to SYSPRINT and continue
3. While writing to output file, write as 140 byte record in one case (note that input is always 80 bytes)
4. At the end write the LOG file with the count of records received and the GDG where it was copied.
We need to know 2 things
1. How does it identify invalid records?
2. How does it merge data from 2 separate lines and how does it know the output size to be written?
Code: Select all
TITLE 'SY110A - REBUILD FILE FROM CARDS CREATED BY FILECARD'
* SY110A
* THIS UTILITY WILL PROCESS INPUT FROM THE MVS UTILITY FILECARD
* OR THE DOS UTILITIES DSKCARD OR TAPECRD.
MACRO
&NAME $FILL
&NAME MVC PLINE,=CL121' '
MEND
*SY110A $ENTER BASE1=R11
SY110A $PROLOG R11
EJECT
$REGS
EJECT
OPEN (IN,INPUT,PRT,OUTPUT) ->Open I/P file and O/P file
LA R10,OUT ->will put address of OUT in R10
USING IHADCB,R10 ->It tells the assembler which base register to use.
LA R3,TAPEBUF ->will put address of TAPEBUF in R3
$FILL PLINE
MVC PLINED(60),=CL60'SY110A - CARD TO DISK PROCESSOR' -> SYSPRINT 'SY110A - CARD TO DISK PROCESSOR'
PUT PRT,PLINE
B READLP BR. AND PROCESS FILE
INVREC EQU
$FILL PLINE
MVC PLINED(60),=CL60'SY110A - INPUT RECORD INVALID'
PUT PRT,PLINE
$FILL PLINE
MVC PLINED(60),CRDREC
PUT PRT,PLINE
$FILL PLINE
MVC PLINED(60),=CL60' RECORD ID INVALID CC1-8'
PUT PRT,PLINE
READLP EQU
GET IN,CRDREC
CLI CRDREC,C' ' SEE IF BLANK RECORD
BNE READLP2 BR. AND IGNORE IT
CLC CRDREC(L'CRDREC-1),CRDREC
BE READLP BR. AND IGNORE IT
READLP2 DS 0H
CLC CDID,=CL8'TAPECRD'
BNE INVREC
CLC BLKNUM,HBLKNUM SEE IF NEXT BLOCK
BH WRTBUF HI, BR. AND WRITE TAPEBUF
BE RDCONT EQUAL CONTINUE TO BUILD BUFFER
LA R0,1 SEE IF WE'RE STARTING OVER AT 1
C R0,BLKNUM
BNE READLP NOPE, DUPLICATED BLOCK
C R0,RECNUM IS IT CARD #1
BNE READLP NOPE, DUPLICATED BLOCK
MVC DUPBLK,HBLKNUM SAVE DUPLICATATED BLOCK #
XC LASTREC,LASTREC RESET THE RECORD NUMBER
ZAP SAVECRD#,NUMCRDS SAVE LAST CARD #
OI EOFLAG,DUPBLKEO
ST R0,HBLKNUM
B WRTBUF WRITE HOPEFULLY NON DUP. DATA
RDCONT EQU
MVI BUFFLG,C'Y' MARK AS TAPEBUF CONTAINS SOME DATA
MVC HBLKNUM,BLKNUM SAVE CURRENT BLOCK NUMBER
L R2,RECNUM LOAD CURRENT RECORD COUNT
BCTR R2,0 SUBTRACT 1
C R2,LASTREC MULT BY MAX AMT DATACARD
BNE READLP DONT ACCEPT DUPLICATE RECORDS
L R1,RECBYTES #USED BYTES IN THIS CARD RECORD
BCTR R1,0 RELATIVE TO ZERO
EX R1,MVCTOBUF MOVE THE DATA
AP NUMCRDS,=P'1' BUMP NUMBER OF CARDS
CP NUMCRDS,=P'1' IS THIS THE FIRST CARD
BH RDCONT2 NO, CONTINUE
MVC SAVBLKSZ,BLKSIZE SAVE THE BLKSIZE
RDCONT2 EQU
LA R3,1(R3,R1) BUMP INDEX
MVC LASTREC,RECNUM BUMP INDEX
B READLP BR. AND READ NEXT CARD
MVCTOBUF MVC 0(0,R3),CRDDTA MOVE TO OUTPUT
WRTBUF EQU
MVI SWITCH,C'N'
BAL R9,PUTIT WRITE TAPE RECORD
B RDCONT
PUTIT DS 0H
TM DCBOFLGS,DCBOFOPN HAVE WE OPENED THE OUTPUT FILE
BO PUTIT2 YES, CONTINUE
L R2,SAVBLKSZ
STH R2,DCBBLKSI
OPEN (OUT,OUTPUT) OPEN THE OUTPUT FILE
PUTIT2 DS 0H
LA R4,TAPEBUF POINT TO BUFFER ORIGIN
SR R3,R4 CALC. ACT. PHYS BLK LEN.
STH R3,DCBLRECL SAVE IT AS LRECL
PUT OUT,TAPEBUF OUTPUT IT
XC LASTREC,LASTREC RESET LAST RECORD READ
LR R3,R4 RESET BUFFER POINTER
AP NUMTAPE,=P'1' BUMP TAPE BLOCKS
MVI BUFFLG,C'N' RESET TAPEBUF FLAG
BR R9 GET OUT
EOJ EQU
CLI BUFFLG,C'N' SEE IF TAPEBUF EMPTY
BE EOJCONT TAPEBUF IS EMPTY
BAL R9,PUTIT WRITE TAPE RECORD
EOJCONT EQU
MVC NUMFLD,NUMEDIT
ED NUMFLD,NUMCRDS
MVC CONM2V,NUMFLD+1
$FILL PLINE
MVC PLINED(60),CONMSG2
PUT PRT,PLINE
MVC NUMFLD,NUMEDIT
ED NUMFLD,NUMTAPE
MVC CONM1V,NUMFLD+1
$FILL PLINE
MVC PLINED(60),CONMSG1
PUT PRT,PLINE
$FILL PLINE
TM EOFLAG,DUPBLKEO DID WE HAVE DUPLICATE BLKS
BNO PUTCONT2
L R0,DUPBLK
CVD R0,DW
UNPK CONM3V,DW
OI CONM3V+L'CONM3V-1,C'0'
ZAP DW,SAVECRD#
UNPK CONM3V2,DW
OI CONM3V2+L'CONM3V-1,C'0'
$FILL PLINE
MVC PLINED(60),CONMSG3
PUT PRT,PLINE
PUTCONT2 DS 0H
MVC PLINED(60),=CL60'SY110A - END OF PROCESSING'
PUT PRT,PLINE
CLOSE (IN,,PRT)
TM DCBOFLGS,DCBOFOPN DID WE OPEN THE OUTPUT
BZ BYPCLOS NOPE, DON'T CLOSE IT
CLOSE (OUT)
BYPCLOS DS 0H
OPEN (LOG,OUTPUT) OPEN THE LOG FILE
TM LOG+DCBOFLGS-IHADCB,DCBOFOPN DID WE OPEN OK
BNO BYPCLOS2 NOPE FORGET IT
RDJFCB OUT GET HIS JFCB
MVC LDSNAME,JFCBDSNM SAVE DSN
LH R1,DCBBLKSI GET THE BLKSIZE
CVD R1,DWORD CONVERT IT FOR EDIT
MVC LBLKSIZ,NUMEDIT EDIT IT
ED LBLKSIZ,DWORD+4
MVI LBLKSIZ,C'='
LTR R1,R1 IS THERE A BLKSIZE
BNZ BYPCLOS1 IF THERE WAS ONE WE'RE OK
MVC LMSG,EMSGLOG
BYPCLOS1 DS 0H
TIME DEC GET DATE&TIME
STM R0,R1,DWORD SAVE THEM
MVC LRUNDT,DATEPAT
ED LRUNDT,DWORD+5 RUN DATE
MVC LRUNTM,DATEPAT
ED LRUNTM,DWORD RUN TIME
MVC LBLKS,NUMEDIT
ED LBLKS,NUMTAPE # OUTPUT BLKS
MVI LBLKS,C'='
PUT LOG,LOGREC OUTPUT THE LOG RECORD
CLOSE LOG CLOSE THE LOG AND BYE-BYE
BYPCLOS2 DS 0H
* $EXIT RC=0
$EPILOG 0
PRINT NOGEN
OUT DCB DSORG=PS,MACRF=(PM),DDNAME=OUT,EXLST=EXLST
IN DCB DSORG=PS,RECFM=FB,LRECL=80,MACRF=(GM),DDNAME=IN, X
EODAD=EOJ
PRT DCB DSORG=PS,RECFM=FBA,LRECL=121,MACRF=(PM),DDNAME=SYSPRINT
LOG DCB DSORG=PS,RECFM=FB,LRECL=LOGRECL,MACRF=(PM),DDNAME=LOG, X
BLKSIZE=LOGRECL 1 RECORD PER RUN
WORKAREA DS 0D
DWORD DS D
EXLST DS 0F
DC X'87' INDICATE THIS IS FOR READJFCB
DC AL3(JFCB)
SWITCH DC CL1'Y'
PLINE DS 0CL121
DC C' '
PLINED DC CL120' '
NUMCRDS DC PL4'0'
NUMTAPE DC PL4'0'
SAVECRD# DC PL4'0'
NUMFLD DC XL8'4020202020202120'
NUMEDIT DC XL8'4020202020202120'
DATEPAT DC X'4020204B202020'
CONMSG1 DS 0CL60
DC CL32'SY110A - DISK BLOCKS WRITTEN ='
CONM1V DC CL7'.......'
DC CL23' '
CONMSG2 DS 0CL60
DC CL32'SY110A - INPUT CARDS READ ='
CONM2V DC CL7'.......'
DC CL23' '
CONMSG3 DS 0CL60
DC C'SY110A - AFTER BLOCK #='
CONM3V DC CL8'.......'
DC C',CARD#='
CONM3V2 DC CL8'.......'
DC C',2D FILE STARTED '
ORG CONMSG3+L'CONMSG3
BUFFLG DC C'N'
EOFLAG DC X'0'
DUPBLKEO EQU 1
HBLKNUM DC F'1'
DUPBLK DC F'0'
SAVBLKSZ DC F'0'
DW DS D
CRDREC DS 0CL80
CDID DC CL8'TAPECRD' RECORD ID
BLKNUM DC XL4'00' TAPE BLOCK NUMBER
BLKSIZE DC XL4'00' CURRENT BLOCK SIZE
RECNUM DC XL4'00' CURRENT CRDREC NUMBER
RECBYTES DC XL4'00' NUMBER OF BYTES USED ON THIS REC
CRDDTA DC XL56'00'
LASTREC DC F'0'
LOGREC DS 0C
LMSG DC C' CREATED '
LRUNDT DS CL(L'DATEPAT)
LRUNTM DS CL(L'DATEPAT-1)
DC C',BLKSIZE'
LBLKSIZ DS CL(L'NUMEDIT)
DC C',BLK COUNT'
LBLKS DS CL(L'NUMEDIT)
DC C',DSNAME='
LDSNAME DS CL(L'JFCBDSNM)
LOGRECL EQU *-LOGREC
EMSGLOG DC CL(L'LMSG)' NO DATA'
PRINT GEN
JFCB DS 0F
IEFJFCBN LIST=YES
LTORG
TAPEBUF DS 0D
TAPEREC DC 32768X'FF' TAPE OUTPUT BUFFER
DC 56X'FF'
DCBD DSORG=PS,DEVD=DA
END SY110A