I am running V5R1 so I have *read. I was playing around with the earlier question with some sample code and I have a question. How do you stop a read? This is how I implemented it: ... C IF RECKEY='yabba' C exsr fail C return C EndIf ... C Fail BEGSR C CALLP QMHSNDPM('CPF9898': C 'QCPFMSG QSYS ': C 'Not authorized to record.': C 300: C '*ESCAPE': C '*': C 1: C xyz#a: C errc0100) C ENDSR ... And my joblog looks like this when I do a RUNQRY QRYFILE(mylib/myfile) runqry qryfile(mylib/myfile) Not authorized to record.. Application error. CPF9898 unmonitored by TRIGGER at statement *N, instruction X'0000'. Error occurred in trigger program. Query cannot be run. See lower level messages. Query cannot be run. See lower level messages. I think this is user vicious. Granted - rpg would be easier to handle because you can check for %status, %error and what not - like I do with the following: FTESTFILE IF E K DISK INFDS(testfileds) F rename(testfile:testfiler) D testfileds DS D tf_FILE *FILE D tf_OPEN_IND 9 9N D tf_EOF_IND 10 10N D tf_STATUS *STATUS D tf_OPCODE *OPCODE D tf_ROUTINE *ROUTINE D tf_LIST_NUM 30 37 D tf_SPCL_STAT 38 42S 0 D tf_RECORD *RECORD D tf_MSGID 46 52 D tf_SCREEN *SIZE D tf_NLS_IN *INP D tf_NLS_OUT *OUT D tf_NLS_MODE *MODE d gohome s n inz(*off) d x s 10i 0 d y s like(x) /free setll(e) *loval testfile; read(e) testfile; // if tf_STATUS=1299 'Other I/O error detected' // this is probably a trigger error. dow not gohome; read(e) testfile; gohome=*off; // if you want to break out of the loop - use the debugger. // Below is a nice breakpoint to set. x=y; enddo; *inlr=*on; return; /end-free Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.