RC variable in IF-THEN-ELSE construct



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

RC variable in IF-THEN-ELSE construct

Postby rbs1121 » Thu Oct 31, 2013 8:04 pm

The RC (return code) is available to be interrogated by the IF statement in a subsequent step. Is there a way to make the RC available to a program, either as a PARM or as a data element that could be written to a file?
rbs1121
 
Posts: 3
Joined: Thu Oct 24, 2013 2:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: RC variable in IF-THEN-ELSE construct

Postby Akatsukami » Thu Oct 31, 2013 8:08 pm

You'll have to "chase control blocks" for it. I don't know offhand if there's an example on this board; I'll see what's in my sandbox (I have a vague memory that I have a proof-of-concept program somewhere).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: RC variable in IF-THEN-ELSE construct

Postby Akatsukami » Thu Oct 31, 2013 9:05 pm

Here is a PL/I program that displays the names and return codes of prior steps:
 MTCB:  PROC OPTIONS (MAIN) REORDER;                           
 DCL AMODE24                      CHAR (3) BASED,               
     STEP                         CHAR (8),                     
     STEPNAME                     CHAR (8) BASED,               
     STUFF                        CHAR (64) BASED,             
     (STEP#, BYPASS)              FIXED BIN (8)  UNSIGNED,     
     UFXB8                        FIXED BIN (8)  UNSIGNED BASED,
     RCSTEP                       FIXED BIN (16) UNSIGNED,     
     UFXB16                       FIXED BIN (16) UNSIGNED BASED,
     I                            FIXED BIN (31),               
     (TCB, TIOT, WORK, JSCB, JCT, FSCT)                         
                                  POINTER,                     
     MASK                         POINTER BASED;               
 DCL (POINTERVALUE, UNSPEC)       BUILTIN;                     
                                                               
 WORK = POINTERVALUE(540);                                     
 TCB  = WORK->MASK;                                             
 WORK = TCB;                                                   
 WORK = TCB + 12;                                               
 TIOT = WORK->MASK;                                             
 WORK = TCB + 180;                                             
 JSCB = WORK->MASK;                                             
 WORK = JSCB;                                                   
 WORK = JSCB + 261;                                             
 UNSPEC(JCT) = UNSPEC('00'X || WORK->AMODE24);     /*           
 PUT SKIP EDIT ('JCT = ', UNSPEC(JCT)) (A, B(32)); */           
 WORK        = JSCB + 228;                                     
 STEP#       = WORK->UFXB8;                                     
 WORK        = JCT + 48;                                       
 UNSPEC(FSCT) = UNSPEC('00'X || WORK->AMODE24);                 
                                                               
 DO I = 1 TO STEP#-1;                                           
   WORK   = FSCT + 68;                                         
   STEP   = WORK->STEPNAME;                                     
   WORK   = FSCT + 24;                                         
   RCSTEP = WORK->UFXB16;                                       
   WORK   = FSCT + 188;                                         
   BYPASS = WORK->UFXB8;                                   
                                                           
   IF (BYPASS = 128) THEN                                   
     PUT SKIP EDIT ('STEP ==>', STEP, ' FLUSHED') (A, A, A);
   ELSE                                                     
     PUT SKIP EDIT ('STEP ==>', STEP, ' RC ==>', RCSTEP)   
                   (A, A, A, F(4));                         
                                                           
   WORK = FSCT + 36;                                       
   UNSPEC(FSCT) = UNSPEC('00'X || WORK->AMODE24);           
 END;                                                       
                                                           
 END MTCB;                                                 
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post