|
View previous topic :: View next topic
|
| Author |
Message |
chavinash2004
New User

Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
Hi Team,
I'm working on REXX tool to get the list of affinities used in CICS program.
I'm facing the issue if we have "EXEC CICS" & "END-EXEC" are on same line.
Example 1:
Input:
| Code: |
AAAAAAA | EXEC CICS RETURN END-EXEC.
AAAAAAA | EXEC CICS LINK
AAAAAAA | PROGRAM (WS-LOG-PRG)
AAAAAAA | COMMAREA (WS-LNK-ERROR)
AAAAAAA | LENGTH (LENGTH OF WS-LNK-ERROR)
AAAAAAA | RESP (CICS-RESP)
AAAAAAA | END-EXEC.
|
Output of Example 1 is not populating the link statement by my requirement of output should be same as Example 2.
Example 2:
Input:
| Code: |
AAAAAAA | EXEC CICS RETURN
AAAAAAA | END-EXEC.
AAAAAAA | EXEC CICS LINK
AAAAAAA | PROGRAM (WS-LOG-PRG)
AAAAAAA | COMMAREA (WS-LNK-ERROR)
AAAAAAA | LENGTH (LENGTH OF WS-LNK-ERROR)
AAAAAAA | RESP (CICS-RESP)
AAAAAAA | END-EXEC.
|
Output of Example 2:
PROGRAM | COMMAND TYPE
AAAAAAA | LINK PROGRAM | WS-LOG-PRG
I'm able to understand that is because, we are checking for first 8 position for END-EXEC but not able to fix it.
| Code: |
when left( tail, 9 ) = "EXEC CICS" then do
exec = space( exec tail )
end
when left( tail, 8) = "END-EXEC" then do
exec = space( exec tail )
select
when wordpos( word( exec, 3), "LINK XCTL ") > 0 then do
|
For example 1 output is blank but output should similar to example 2.
Here is my code:
| Code: |
/* REXX */
/* TRACE ALL */
CLRSCRN
ADDRESS TSO
SAY "ENTER INPUT FILE WITH LIST OF EXEC STMTS"
PULL DSN1
PS1=STRIP(DSN1)
SAY "ENTER THE OUTPUT FILE TO WRITE THE REPORT WITH AFFNITIES"
PULL DSN2
PS2=STRIP(DSN2)
/*----------------TO LOAD ALL EXEC STMTS TO ARRAY---------------*/
"ALLOC F(INFILE) DA('"||PS1||"') SHR "
"EXECIO * DISKR INFILE (STEM DATA. FINIS"
"FREE FI(INFILE)"
/*----TO DELETE THE DATA FROM O/P FILE BEFORE WRITTING */
"ALLOC F(OUTFILE) DA('"||PS2||"') SHR "
"EXECIO 0 DISKW OUTFILE (OPEN FINIS"
"FREE FI(OUTFILE)"
/*--------------------------------------------------------------*/
QUEUE "PROGRAM | COMMAND TYPE "
CALL RPT_EXTRACT
CALL WRITE_OUTPUT
/*--------------------------------------------------------------*/
/* read exec statements and write the report */
/*--------------------------------------------------------------*/
RPT_EXTRACT:
/*--------------------------------------------------------------*/
exec = ""; iden = ""; line = ""
do i = 1 to data.0
work = translate(data.i, " ", "'")
work = translate(work )
work = space(work)
parse var work head "|" tail
head = strip( head )
line = head "|"
tail = strip( tail )
line = head "|"
p = pos( " (", tail )
do while p > 0
tail = left( tail, p-1) || substr( tail, p+1)
p = pos( " (", tail )
end
select
when left( tail, 9 ) = "EXEC CICS" then do
exec = space( exec tail )
end
when left( tail, 8) = "END-EXEC" then do
exec = space( exec tail )
select
when wordpos( word( exec, 3), "LINK XCTL ") > 0 then do
line = line word( exec, 3)
parse value(space(exec,0)) with . "PROGRAM(" iden ")" .
if iden ª= "" then do
line = line "PROGRAM" "|"
end
if iden ª= "" then do
line = line iden
QUEUE LINE
end
end
when wordpos( word( exec, 3), "ASSIGN ") > 0 then do
line = line word( exec, 3)
parse value(space(exec,0)) with . "APPLID(" iden ")" .
if iden ª= "" then do
line = line "APPLID" "|"
line = line iden
QUEUE LINE
end
parse value(space(exec,0)) with . "SYSID(" iden ")" .
if iden ª= "" then do
line = ""
line = head "|"
line = line word( exec, 3)
line = line "SYSID" "|"
line = line iden
QUEUE LINE
end
end
otherwise do
nop
end
end
exec = ""; iden = ""; line = ""
end
otherwise do
exec = space( exec tail )
end
end
end
return
/*--------------------------------------------------------------*/
/* write output at EOF */
/*--------------------------------------------------------------*/
WRITE_OUTPUT:
/*--------------------------------------------------------------*/
"ALLOC FI(REPT) DA('"||PS2||"') SHR REU"
DATALINES = QUEUED()
DO DATALINE = 1 TO DATALINES
"EXECIO 1 DISKW REPT"
END
"EXECIO 0 DISKW REPT (FINIS"
"FREE FI(REPT)"
EXIT
|
Can someone help me to fix this.
Stay safe from Corona Virus.
I'm not able to move this topic to REXX. Requesting someone to move this to REXX. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Stick another WHEN clause in testing for both EXEC CICS and END-EXEC. This would have to precede both the WHEN for EXEC CICS and the WHEN for END-EXEC. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
since I had already fixed the thing for the ORIgiNAL REQUEST
warning ...
no attempt to resync the for missing EXEC CICS and END-exec
the TS can do it himself
even if the TS main issue is the logic , the code is just a lowly technicality
he would have asked even if he had to do it in COBOL
| Code: |
Trace "O"
/* do Your own reading of the input */
exec = ""; iden = ""; line = ""
do i = 1 to data.0
work = translate( data.i, " ", "'")
work = translate( work )
work = space( work )
parse var work head "|" tail
head = strip( head )
line = head "|"
tail = strip( tail )
-- say "at ".line~right(3) ">>"head"<<"
-- say "at ".line~right(3) ">>"tail"<<"
p = pos( " (", tail )
do while p > 0
tail = left( tail, p-1) || substr( tail, p+1)
p = pos( " (", tail )
end
select
when pos( "END-EXEC", tail ) > 0 then do
exec = space( exec tail )
-- say "at ".line~right(3) " >>"exec"<<"
-- say "at ".line~right(3) " >>"word( exec, 3)"<<"
select
when wordpos( word( exec, 3), "LINK XCTL" ) > 0 then do
line = line word( exec, 3) "|"
parse value(space(exec,0)) with . "PROGRAM(" iden ")" .
line = line iden "|" "NA" "|" "NA" "|"
end
when wordpos( word( exec, 3), "WRITE READ INQUIRE STARTBR ENDBR READNEXT" ) > 0 then do
line = line word( exec, 3) "|"
parse value(space(exec,0)) with . "FILE(" iden ")" .
if iden = "" then ,
parse value(space(exec,0)) with . "DATASET(" iden ")" .
line = line "NA" "|" iden "|" "NA" "|"
end
when wordpos( word( exec, 3), "READQ WRITEQ" ) > 0 then do
line = line word( exec, 3)
line = line word( exec, 4) "|"
parse value(space(exec,0)) with . "QUEUE(" iden ")" .
line = line "NA" "|" "NA" "|" iden "|"
end
otherwise do
line = line "NA" "|" "NA" "|" "NA" "|" "NA" "|"
end
end
say line
exec = ""; iden = ""; line = ""
end
when left( tail, 9 ) = "EXEC CICS" then do
exec = space( tail )
-- say "at ".line~right(3) " >>"exec"<<"
end
otherwise do
exec = space( exec tail )
end
end
end
|
the input
| Code: |
BBBBBBBB | EXEC CICS END-EXEC.
cccccccc | EXEC CICS RETURN
cccccccc | END-EXEC.
AAAAAAA | EXEC CICS LINK
AAAAAAA | PROGRAM (WS-LOG-PRG)
AAAAAAA | COMMAREA (WS-LNK-ERROR)
AAAAAAA | LENGTH (LENGTH OF WS-LNK-ERROR)
AAAAAAA | RESP (CICS-RESP)
AAAAAAA | END-EXEC.
A | EXEC CICS LINK
A | PROGRAM (WS-LOG-PRG2)
A | COMMAREA (WS-LNK-ERROR)
A | LENGTH (LENGTH OF WS-LNK-ERROR)
A | RESP (CICS-RESP) END-EXEC.
A |
|
the output
| Code: |
BBBBBBBB | NA | NA | NA | NA |
CCCCCCCC | NA | NA | NA | NA |
AAAAAAA | LINK | WS-LOG-PRG | NA | NA |
A | LINK | WS-LOG-PRG2 | NA | NA |
|
|
|
| Back to top |
|
 |
chavinash2004
New User

Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
It worked. Thanks for your time and help on this.
Thanks once again and stay safe. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|