- In Cics as its in batch we have the same metods of access ,only difference is in the commands .
- Lats us comapre batch to CICS and see the simialrity ,and understand the concept better.
- In batch if we have a partial key info available and we want to browse the same
MOVE SPACES TO TRNM-KEY.
MOVE partial info TO TRNM-KEY.
Ie
MOVE WS-IN-ACCT-CORP TO TRNM-CORP.
MOVE WS-IN-ACCT-COMP TO TRNM-COMP.
MOVE WS-IN-ACCT-MAJR TO TRNM-MAJR.
MOVE WS-IN-ACCT-MINR TO TRNM-MINR.
START IN-GLMATR-FILE KEY NOT < TRNM-KEY.
READ IN-GLMATR-FILE NEXT RECORD.
IF IN-GLMATR-EOF
MOVE 'Y' TO WS-GLMATR-END-OF-FILE
GO TO 2100-900-EXIT
END-IF.
IF IN-GLMATR-ST = '00'
IF WS-IN-ACCT-CORP = TRNM-CORP
AND WS-IN-ACCT-COMP = TRNM-COMP
AND WS-IN-ACCT-MAJR = TRNM-MAJR
AND WS-IN-ACCT-MINR = TRNM-MINR
PERFORM 2105-SELECTED
ELSE
MOVE 'Y' TO WS-GLMATR-END-OF-FILE
GO TO 2100-900-EXIT
END-IF
END-IF.
Note that when the basic key values passed itself don’t match ,we do an EOF forcibly to prevent further proccessing .
In case of CICS
EXEC CICS HANDLE CONDITION
018670 DISABLED(D510-NOT-AVAILABLE)
018680 DUPREC
018690 ENDFILE (D520-ENDFILE)
018700 NOSPACE
018710 NOTFND (D515-NOT-FOUND)
018720 NOTOPEN (D510-NOT-AVAILABLE)
018730 END-EXEC.
018740
018750 EXEC CICS STARTBR
018760 FILE ('FREQCLUB') -------à>> file name .
018770 KEYLENGTH (WS-GEN-KEY-LENGTH) ==è>> key size of the partial key being used .
018780 REQID (WS-REQID) =è>
018790 RIDFLD (RWF01-00-RECORD-KEY)
018800 GENERIC ==========================è only for ksds .indicates only part of the key should be used .
018810 GTEQ ============è > or = to key
18820 END-EXEC.
Then we use
EXEC CICS READNEXT
019380 FILE ('FREQCLUB')
019390 INTO (WS-IN-FREQ-FILE)
019400 LENGTH (WS-FILE-LENGTH)
019410 REQID (WS-REQID)
019420 RIDFLD (RWF01-00-RECORD-KEY)
019430 END-EXEC.
019440
EXEC CICS ENDBR
020390 FILE ('FREQCLUB')
020400 END-EXEC.
This is to eplicitly end the browse operation .
For update of the file we will use
000591 EXEC CICS READ
000592 FILE('WPRD010')
000593 INTO(WS-PROM-SHIPPER-REC)
000594 RIDFLD(AI-RECKEY)
000595 UPDATE
000601 RESP(RESPONSE-CODE)
000596 END-EXEC.
000597
000586 EVALUATE TRUE
000587 WHEN RESPONSE-CODE = DFHRESP(NORMAL)
000588 CONTINUE
000592 WHEN OTHER
000593 EXEC CICS
000594 ABEND
000595 END-EXEC
000596 END-EVALUATE.
000000
000598 EXEC CICS REWRITE
000599 FILE('WPRD010')
000600 FROM(PROMO-SHIPPER-FILE)
000601 RESP(RESPONSE-CODE)
000584 END-EXEC.
For write
00560 EXEC CICS WRITE
000561 FROM(PROMO-SHIPPER-FILE)
000562 RIDFLD (AI-RECKEY)
000563 DATASET('WPRD010')
000564 RESP(RESPONSE-CODE)
565 END-EXEC.
NOTE:-
IN the STARTBR coomand first we specify the key value in the RIDFLD .but once the command executes ,the value returned to this field is an identifier of the record got .
No comments:
Post a Comment