Code conversion issue while reading JCL using REXX



IBM's Command List programming language & Restructured Extended Executor

Code conversion issue while reading JCL using REXX

Postby vsgurunath » Fri Jun 19, 2020 10:19 pm

Hi Experts/Forum members,

For developing a REXX routine to process JCL statements to search and replace symbolic variables (with different masking format like 'YYDDD' for Julian date or 'YY-MM-DD' for Current Calendar date) in any position in the JCL statement. I have an indicator for such statements: '!' in column 66 with different codes for different date formats/values.

I will have to search for '!' to identify JCL statement with a date mask, say, 'YYDDD', then replace it with '20170' and write this JCL member into a different PDS for current day's test run.

Weirdly, when I used the REXX POS function
POS(needle,haystack[,startcix])
to search for '!' in column 66, the statement of some of the JCL members were internally converted into a different code format that left this check for '!' with incorrect result - returned as '0' even though I see '!' on that statement through 3.4 screen.

Example:
Original statement is
// OCYCLE=DXYYDDD1   CURRENT  DATE                               !AAA   00109001

TRACE result shows
// OCYCLE=DXYYDDD1?FCURRENT?CDATE?C!AAA?G00109001B//*àG00109101.


Please advise if there is any other alternative way/logic using which I can programmatically (REXX) correctly check for the code indicator on such JCL statements.

Thank you for your time and inputs,
Sivagurunathan V
vsgurunath
 
Posts: 7
Joined: Fri Feb 08, 2013 12:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Code conversion issue while reading JCL using REXX

Postby Pedro » Fri Jun 19, 2020 10:32 pm

Can you clarify the origin of your JCL statement? Is it in an ISPF skeleton format?

Please use ISPF VIEW and issue the PROFILE command and show us the response.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Code conversion issue while reading JCL using REXX

Postby sergeyken » Fri Jun 19, 2020 10:33 pm

Where is your code?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Code conversion issue while reading JCL using REXX

Postby willy jensen » Sat Jun 20, 2020 2:27 pm

For checking a specific character in a specific position I would use the 'substr' function, i.e. if substr(rec,66,1)='!' then...
But your 'pos' should still work, so I too would like to see a snippet of your program.
Have you tried a trace around the code section?
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: Code conversion issue while reading JCL using REXX

Postby Pedro » Sun Jun 21, 2020 2:58 am

It seems more like the data is not in the expected format.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Code conversion issue while reading JCL using REXX

Postby vsgurunath » Mon Jun 22, 2020 8:29 pm

Thank you very much for your responses and my apologies for the delay. Didn't login during the weekend.

I must've gotten confused while posting this, after using different alternatives to fix/understand why such an issue was happening internally.
Seems i have used 'INDEX' and not 'POS'. Still it worked on 90% of the elements correctly and identified the indicator i was searching for.

First, answers to previously asked questions:
- The JCLs this exec is processing are manually-typed ones (not generated through Skeletons).
- This issue is not happening in all the JCL members. Only specific ones. I checked for non-readable characters using "f p'.'" command and didn't get any hit. Please let me know if I should check for more values or in a different way.

Herewith sharing the code and TRACE output I see in SYSOUT (I am executing the exec via batch):

Trace output (SYSTSPRT): The statements 120-122 are showing the issue I am trying to understand the reason for, with all your guidance.

118 *-*      DO B = 1 TO JCLSTEM.0                                          
119 *-*       CMD = "PARSE UPPER VAR JCLSTEM.B JCLSTMT"                    
    >L>         "PARSE UPPER VAR JCLSTEM.B JCLSTMT"                        
120 *-*       INTERPRET CMD                                                
    >V>         "PARSE UPPER VAR JCLSTEM.B JCLSTMT"                        
    *-*        PARSE UPPER VAR JCLSTEM.B JCLSTMT                            
    >C>          "JCLSTEM.10"                                              
    >>>          "// OCYCLE=DXYYDDD1?FCURRENT?CDATE?C!AAA?G00109001B//*.G00109101.                "
121 *-*       SYMBOLPOS  = INDEX(" !",JCLSTMT)                              
    >L>         " !"                                                        
    >V>         "// OCYCLE=DXYYDDD1?FCURRENT?CDATE?C!AAA?G00109001B//*.G00109101.                "
    >F>         "0"                                                        
122 *-*       COMMENTPOS = INDEX("//*",JCLSTMT)                            
    >L>         "//*"                                                      
    >V>         "// OCYCLE=DXYYDDD1?FCURRENT?CDATE?C!AAA?G00109001B//*.G00109101.                "
    >F>         "0"                                                        
123 *-*       IF COMMENTPOS = 0                                            
    >V>         "0"                                                        
    >L>         "0"                                                        
    >O>         "1"                                                        
    *-*        THEN                                                        
124 *-*        DO                  
125 *-*         IF SYMBOLPOS = 65  
    >V>           "0"              
    >L>           "65"            
    >O>           "0"              
132 *-*        END                
133 *-*       JCLSTMT     = " "    
    >L>         " "                
134 *-*       SYMBOLPOS   = 0      
    >L>         "0"                
135 *-*       COMMENTPOS  = 0      
    >L>         "0"                
136 *-*       JCLBANGCODE = " "    
    >L>         " "                
137 *-*      END                  
118 *-*      DO B = 1 TO JCLSTEM.0
139 *-*      TRACE OFF            


REXX Code:
I realize i have complicated a bit around the "CMD" and "INTERPRET" commands while trying to process the statements a different way using forum searches.

/* PROCESS THE JCL MEMBER FOR UPDATING BANG CODES */      
PROCESS_JCL_MEMBER:                                        
                                                           
  SAY 'PROCESSING JCL MEMBER #' RIGHT(JCLCTR2,4,0) JCLNAME
                                                           
  /* READ THE JCL MEMBER */                                
  ADDRESS TSO                                              
  "ALLOC DA('"IPJCLPDS||"("||JCLNAME")') F(JCLMEM) SHR REU"
  "EXECIO * DISKR JCLMEM(STEM JCLSTEM. FINIS"              
  "FREE FI(JCLMEM)"                                        
                                                           
SYMBOLPOS  = 0                                                    
COMMENTPOS = 0                                                    
JCLBANGCODE = " "                                                  
                                                                   
IF JCLNAME = 'PAM296QF' | JCLNAME = 'PAM296QE' THEN                
   DO                                                              
      TRACE I                                                      
   END                                                            
                                                                   
DO B = 1 TO JCLSTEM.0                                              
   CMD = "PARSE UPPER VAR JCLSTEM.B JCLSTMT"                      
   INTERPRET CMD                                                  
   SYMBOLPOS  = INDEX(" !",JCLSTMT)                                
   COMMENTPOS = INDEX("//*",JCLSTMT)                              
   IF COMMENTPOS = 0 THEN                                          
      DO                                                          
         IF SYMBOLPOS = 65 THEN                                    
            DO                                                    
               SAY 'JCL' JCLSTMT                                  
               JCLBANGCODE = STRIP(SUBSTR(JCLSTMT,SYMBOLPOS + 1,5))
               SAY JCLBANGCODE                                    
      /*         CALL FETCH_BANG_CODE */
              END                      
        END                            
     JCLSTMT     = " "                  
     SYMBOLPOS   = 0                    
     COMMENTPOS  = 0                    
     JCLBANGCODE = " "                  
  END                                  
                                       
  TRACE OFF                            
RETURN
 


Please let me know if this makes any sense to you. I wish to ensure that the tool doesn't encounter this scenario as we're planning to schedule this as a batch.
vsgurunath
 
Posts: 7
Joined: Fri Feb 08, 2013 12:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Code conversion issue while reading JCL using REXX

Postby willy jensen » Mon Jun 22, 2020 9:38 pm

It is overly complicated. If all you want to do is to test if '!' is found in col 66 then I suggest that you do somthing like:
DO B = 1 TO JCLSTEM.0
   if substr(jclstem.b,66,1)='!' then do
     ....
   end
 END

I don't see the reason for up-casing, at least not for testing the exclamation mark.
Your test is not for '!' in col 66, it is for ' !' in col 65-66, which probably is why it works sometimes but not all the time.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: Code conversion issue while reading JCL using REXX

Postby Pedro » Mon Jun 22, 2020 11:30 pm

This issue is not happening in all the JCL members. Only specific ones.

You do not have a rexx problem... the problem you have is that the data is not in the format that you expect it to be in. Clearly, the data is previously stored in same way that is not known to us.

Please use ISPF VIEW for the data and scroll to the " OCYCLE=DXYYDDD1" line and issue the PROFILE command and show us the screen capture. I do not believe your 'original statement' from your post.

Example:
Original statement is
// OCYCLE=DXYYDDD1   CURRENT  DATE                               !AAA   00109001


TRACE result shows
// OCYCLE=DXYYDDD1?FCURRENT?CDATE?C!AAA?G00109001B//*àG00109101.


My recommendation is the edit those members and manually fix them the match the format you expect.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Code conversion issue while reading JCL using REXX

Postby sergeyken » Tue Jun 23, 2020 1:34 am

In other words: the input data pretending to be JCL, are actually not in JCL format!
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Code conversion issue while reading JCL using REXX

Postby enrico-sorichetti » Wed Jun 24, 2020 1:57 pm

looks like ISPF packed data to me

edit the ones giving the error and use the command
PACK OFF
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post