Error Handling In Cl Programming
Contents |
"I" (ignore) or "R" (retry) in response to the error message. However, when a user runs a program and encounters an unexpected error, we run into problems. The user might
Cl Programming Tutorial
call us. The user might not call us. The user may pick the cl programming examples wrong option and really mess things up. What can we do? --Sandra You can prevent the user from seeing an inquiry
Cl Programming Not Equal
message when something goes wrong. The first thing you need is a global monitor message (MONMSG) command that branches to an error routine. The other thing you need is an error routine that https://www.ibm.com/support/knowledgecenter/ssw_i5_54/rbam6/monmg.htm sends an escape message. Here is a CL program template I like to use: pgm dcl &Abending *lgl dcl &MsgID *char 7 dcl &MsgDta *char 256 dcl &MsgF *char 10 dcl &MsgFLib *char 10 dcl &MsgKey *char 4 dcl &MsgType *char 10 dcl &RtnType *char 2 dcl &PgmName *char 10 dcl &Sender *char 80 monmsg cpf0000 exec(goto abend) /* retrieve the program name */ sndpgmmsg msg(' ') topgmq(*same) http://www.itjungle.com/fhg/fhg050504-story02.html msgtype(*info) keyvar(&msgkey) rcvmsg pgmq(*same) msgtype(*info) sender(&sender) rmv(*yes) chgvar &PgmName %sst(&Sender 56 10) /* begin regular routine */ /* normal end of job */ sndpgmmsg msgid(cpf9898) msgf(qcpfmsg) msgtype(*comp) + msgdta('Program' *bcat &PgmName *bcat + 'completed normally') return /* Routine to handle unexpected errors */ Abend: if &Abending then(return) chgvar &Abending '1' rcvmsg msgtype(*last) msgdta(&msgdta) msgid(&msgid) + rtntype(&RtnType) + msgf(&msgf) sndmsgflib(&msgflib) if ((&RtnType *eq '15') *or (&RtnType *eq '17')) do /* *escape */ sndpgmmsg msgid(&msgid) msgf(&msgf) msgtype(*diag) + msgdta(&msgdta) enddo Escape: sndpgmmsg msgid(cpf9898) msgf(qcpfmsg) msgtype(*escape) + msgdta('Program' *bcat &PgmName *bcat + 'ended abnormally') endpgm To use this template, you will have to declare any variables or files you use after the PGM command and before the global MONMSG. Then put the commands that you want to run after the comment that indicates the beginning of the regular routine. The rest of the program remains as is. If an unmonitored error occurs in the regular routine, control branches to the ABEND label. The first two calculations make sure that the program doesn't go into a loop if something goes wrong in the ABEND routine. The next lines, up to but not including the ESCAPE label, read the escape message that was unmonitored and send t
Points to remember Menu Driven AS40001 Menu Driven AS400 SEU basic concepts01 SEU Introduction Array01 Array & Types of Array Data structure01 Data structure & Types of DS http://www.go4as400.com/chapterload.aspx?cid=561 User Profile & Security 02 User profile & Securitys Lock status of an obj. As400 Subsys. & Jobs 05 Subsystem AS400 Jobs Activation group User Defined Opions Compiler Directive 01 Compiler Directive Data queue01 Data queue FTP & Stream file03 FTP SNDNETF Stream File & Copy From/To PF Journalling 01 Journalling Screen Design Aid06 Design screen with STRSDA STRSDA for SFLMSG record type STRSDA for SUBF error handling record type STRSDA for WDWSFL record type STRSDA for WINDOW record type STRSDA Test display file Display File Keywords62 ALIAS (Alternative Name) ALTHELP, HELP & HLPARA ALTNAME (Alternative Record Name) ALTPAGEDWN / ALTPAGEUP ASSUME, OVERLAY & KEEP CAnn (Command Attention) CFnn (Command Function) CHECK (Check) CHGINPDFT (Change Input Default) CLRL (Clear line) CNTFLD (Continued-Entry Field) COLOR (Color) COMP (Comparison) CSRLOC (Cursor Location) DATE (Date) DATFMT (Date Format) programming error handling DATSEP (Date Separator) DFT (Default) DFTVAL (Default Value) DSPATR (Display Attribute) DSPMOD (Display Mode) DSPSIZ (Display Size) EDTCDE (Edit Code) EDTWRD (Edit Word) ERRMSG (Error Message) ERRMSGID (Error Message Identifier) ERRSFL (Error Subfile) FLDCSRPRG (Cursor Progression Field) INDARA (Indicator Area) MSGCON (Message Constant) MSGID (Message Identifier) OVERLAY (Overlay) PAGEDOWN & PAGEUP REF (Reference) REFFLD (Referenced Field) ROLLUP & ROLLDOWN RTNCSRLOC (Return Cursor Location) SFL (Subfile) SFLCLR (Subfile Clear) SFLCSRRRN (Subfile Cursor RRN) SFLCTL (Subfile Control) SFLDROP, SFLFOLD & SFLMOD SFLDSP (Subfile Display) SFLDSPCTL (Subfile Display Control) SFLEND (Subfile End) SFLINZ & SFLRNA SFLMSG (Subfile Message) SFLMSGID (Subfile Message ID) SFLMSGKEY, SFLMSGRCD & SFLPGMQ SFLNXTCHG (Subfile Next Changed) SFLPAG (Subfile Page) SFLRCDNBR (Subfile Record Number) SFLROLVAL (Subfile Roll Value) SFLSCROLL (Subfile Scroll) SFLSIZ (Subfile Size) SYSNAME (System Name) TIME (Time) TIMFMT (Time Format) TIMSEP (Time Separator) USER (User) VALUES (Values) WDWBORDER, WDWTITLE & WINDOW Subfile & Types of Subf06 Subfile & Its types Load-All Subfile Expandable Subfile Single Page subfile Message Subfile Session or device error Help panel design01 Help panel design RPG specs07 H-SPEC F-SPEC Access Particular member of a File D-SPEC I-SPEC C-SPEC O-SPEC RPGLE op-codes85 ADD ADDDUR ADDXX BEGSR CABXX CALL CALLB CALLP CASExx
be down. Please try the request again. Your cache administrator is webmaster. Generated Tue, 11 Oct 2016 15:42:42 GMT by s_ac15 (squid/3.5.20)