iSeries – CL program record update.
Posted by QB on June 7, 2008
CL programs can read and update database records as well as read and write formats. CL programs can’t handle large database effectively so it is not good practice to update records from CL programs.
The simple example of CL program record update.
PGM
DCL Var(&FileName) *Char Len(10)
DCL Var(&LibName) *Char Len(10)
ChgVar Var(&FileName) Value(‘AcctPayble’)
ChgVar Var(&LibName) Value(‘Accounts’)
DCLF File(&LibName/&FileName)
Read: RCVF /* Read the first record */
MonMsg MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF))
Process: Do your processing here….. whatever it may be
SndF /* Update record after processing */
GoTo Read
EOF: /* End Of File */
EndPgm
Very simple program to update database.
Update : CLLE program did not update keyed database. It works well for SDA formats. Did not try to update sequential file yet.
janitor said
isnt SNDF only for display files? or is it now working with DB files also?
QB said
SNDF only for for DSPF. SDA formats, not DB.