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.