Rexx or SAS or Easytrive
Moderator: mickeydusaor
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Rexx or SAS or Easytrive
Hi All,
I have a file with all EXEC statements. Now the requirement is to read the all the statements and write a report as below:
affinity | sub program | File| Queue
Example of input file:
EXEC CICS
LINK PROGRAM('AAAAAA')
END-EXEC
EXEC CICS LINK PROGRAM('AAAAAA')
END-EXEC
EXEC CICS LINK
PROGRAM ('AAAAAA')
END-EXEC
OUTPUT:
affinity | sub program | File| Queue
LINK | AAAAAA | NA | NA
I did not find any easiest way to do this.
Please help me to complete this assignment.
Thanks,
Avinash
[ Post made via Android ]
I have a file with all EXEC statements. Now the requirement is to read the all the statements and write a report as below:
affinity | sub program | File| Queue
Example of input file:
EXEC CICS
LINK PROGRAM('AAAAAA')
END-EXEC
EXEC CICS LINK PROGRAM('AAAAAA')
END-EXEC
EXEC CICS LINK
PROGRAM ('AAAAAA')
END-EXEC
OUTPUT:
affinity | sub program | File| Queue
LINK | AAAAAA | NA | NA
I did not find any easiest way to do this.
Please help me to complete this assignment.
Thanks,
Avinash
[ Post made via Android ]
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Thank you enrico.
My apologize for not providing the complete example.
Here is the input file:
Expected Output:
Thanks in advance.
coded to show the proper spacing ...
the output data was clobberd anyway
My apologize for not providing the complete example.
Here is the input file:
Code: Select all
AAAAAAAA | EXEC CICS
AAAAAAAA | LINK
AAAAAAAA | PROGRAM(WS-INVOKED-PGM)
AAAAAAAA | COMMAREA(API-COMMAREA)
AAAAAAAA | RESP (CICS-RESP)
AAAAAAAA | END-EXEC.
AAAAAAAA | EXEC CICS WRITE
AAAAAAAA | FILE (WS-LOG-FILE)
AAAAAAAA | FROM (WS-LOG-RECORD)
AAAAAAAA | LENGTH (LENGTH OF WS-LOG-RECORD)
AAAAAAAA | RIDFLD (WS-RBA)
AAAAAAAA | RBA
AAAAAAAA | RESP (CICS-RESP)
AAAAAAAA | END-EXEC.
AAAAAAAA | EXEC CICS WRITEQ TD
AAAAAAAA | QUEUE ('CSMT')
AAAAAAAA | FROM (WS-CSMT-AREA)
AAAAAAAA | NOHANDLE
AAAAAAAA | END-EXEC.
BBBBBBBB | EXEC CICS LINK PROGRAM ('XXXXXXXX' )
BBBBBBBB | COMMAREA (DSA-COMMAREA )
BBBBBBBB | LENGTH (DSA-COMMAREA-LENGTH)
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS QUEUE (TSQ2-WSD )
BBBBBBBB | INTO (TSQ-AREA )
BBBBBBBB | LENGTH (TSQ-LEN )
BBBBBBBB | ITEM (TSQ-ITEM )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS
BBBBBBBB | QUEUE (WRK-WSD )
BBBBBBBB | INTO (WRK-AREA )
BBBBBBBB | LENGTH (LENGTH OF WRK-AREA)
BBBBBBBB | ITEM (WRK-ITEM )
BBBBBBBB | END-EXEC
BBBBBBBB | EXEC CICS READ INTO (XXXX )
BBBBBBBB | LENGTH (REC-LEN )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | RESP (WS-RESP )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS STARTBR KEYLENGTH (KEY-LEN )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READNEXT INTO (CP01 )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS ENDBR
BBBBBBBB | DATASET(CURR-FILE)
BBBBBBBB | END-EXEC
BBBBBBBB | EXEC CICS INQUIRE FILE (CURR-FILE )
BBBBBBBB | DSNAME (CURR-DSN )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS INQUIRE FILE (CURR-FILE )
BBBBBBBB | DSNAME (CURR-DSN )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS QUEUE (TSQ2-WAD )
BBBBBBBB | INTO (TSQ-AREA )
BBBBBBBB | LENGTH (TSQ-LEN )
BBBBBBBB | ITEM (TSQ-ITEM )
BBBBBBBB | END-EXEC.
CCCCCCCC | EXEC CICS LINK
CCCCCCCC | PROGRAM (ID-PROGRAM)
CCCCCCCC | COMMAREA (ID-COMMAREA)
CCCCCCCC | LENGTH (ID-COMMAREA-LENGTH)
CCCCCCCC | END-EXEC.
CCCCCCCC | EXEC CICS WRITE
CCCCCCCC | FILE ('FILE1')
CCCCCCCC | FROM (FILE1-DSA)
CCCCCCCC | LENGTH (FILE1-LENGTH)
CCCCCCCC | RIDFLD (FILE1-RELATIVE-BYTE)
CCCCCCCC | RBA
CCCCCCCC | END-EXEC.
DDDDDDDD | EXEC CICS XCTL
DDDDDDDD | PROGRAM ('YYYYYYYY')
DDDDDDDD | COMMAREA (DFHCOMMAREA)
DDDDDDDD | LENGTH (WS-SUB)
DDDDDDDD | NOHANDLE
DDDDDDDD | END-EXEC.
EEEEEEEE | EXEC CICS XCTL PROGRAM (AV-XCTL-PGM)
EEEEEEEE | COMMAREA (CA-COMMAREA)
EEEEEEEE | LENGTH (IMS-COMM-FP-LEN)
EEEEEEEE | END-EXEC.
Code: Select all
Program | Command | Sub program | FILE NAME | QUEUE NAME |
AAAAAAAA | LINK | WS-INVOKED-PGM | NA | NA |
AAAAAAAA | WRITE | NA | WS-LOG-FILE | NA |
AAAAAAAA | WRITEQ TD | NA | NA | CSMT |
BBBBBBBB | LINK | XXXXXXXX | NA | NA |
BBBBBBBB | READQ TS | NA | NA | TSQ2-WSD |
BBBBBBBB | READQ TS | NA | NA | WRK-WSD |
BBBBBBBB | READ | NA | CURR-FILE | NA |
BBBBBBBB | STARTBR | NA | CURR-FILE | NA |
BBBBBBBB | READNEXT | NA | CURR-FILE | NA |
BBBBBBBB | ENDBR | NA | CURR-FILE | NA |
BBBBBBBB | INQUIRE | NA | CURR-FILE | NA |
BBBBBBBB | INQUIRE | NA | CURR-FILE | NA |
BBBBBBBB | READQ TS | NA | NA | TSQ2-WAD |
CCCCCCCC | LINK | ID-PROGRAM | NA | NA |
CCCCCCCC | WRITE | NA | FILE1 | NA |
DDDDDDDD | XCTL | YYYYYYYY | NA | NA |
EEEEEEEE | XCTL | AV-XCTL-PGM | NA | NA |
coded to show the proper spacing ...
the output data was clobberd anyway
Re: Rexx or SAS or Easytrive
Please use the code tags for presenting data.
What has the topic title to do with your "question" as posted?
What have you tried? You have been given a clue as to how to do it in Rexx so what is your problem?
Remember - we do not read minds and we do not do your work for you although we may help to fix it.
What has the topic title to do with your "question" as posted?
What have you tried? You have been given a clue as to how to do it in Rexx so what is your problem?
Remember - we do not read minds and we do not do your work for you although we may help to fix it.
Regards
Nic
Nic
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Thanks a lot enrico.
I will try this code and let you know.
I'm very new to rexx and this is my 2nd assignment in rexx. I did not an idea how to start this. Thanks again.
Have a great day ahead:).
I will try this code and let you know.
I'm very new to rexx and this is my 2nd assignment in rexx. I did not an idea how to start this. Thanks again.
Have a great day ahead:).
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Thank you Nic. From now i will add code tags and will make sure to add appropriate subject line.
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Hi Enrico,
Code is not working for "scenario 2" since the code is checking for "when wordpos( word( exec, 3), "LINK XCTL" ) > 0".
also in "Scenario 1" the parse logic (parse value(space(exec,0)) with . "PROGRAM(" iden ")" .) is not working.
I got some idea by looking at your code. Thanks again for this. I'm trying to find the issue and fix it.
Hi Nic,
I have used the code tags. Hope this is fine please let me now if i miss any thing else.
Thank you.
Code is not working for "scenario 2" since the code is checking for "when wordpos( word( exec, 3), "LINK XCTL" ) > 0".
also in "Scenario 1" the parse logic (parse value(space(exec,0)) with . "PROGRAM(" iden ")" .) is not working.
Code: Select all
Scenario 1:
000020 BBBBBBBB | EXEC CICS LINK PROGRAM ('XXXXXXXX' )
Scenario 2:
000001 AAAAAAAA | EXEC CICS
000002 AAAAAAAA | LINK
000003 AAAAAAAA | PROGRAM(WS-INVOKED-PGM)
Hi Nic,
I have used the code tags. Hope this is fine please let me now if i miss any thing else.
Thank you.
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Hi Enrico,
I observed after the below logic i.e., line num 31 it's directly moving to Otherwise condition. so i have commented the code line 30 & 31 after that also it's not working.
I'm not sure if i miss something here.
My complete code(same as you provided):
Input:
Output:
I observed after the below logic i.e., line num 31 it's directly moving to Otherwise condition. so i have commented the code line 30 & 31 after that also it's not working.
I'm not sure if i miss something here.
Code: Select all
000026 when left( tail, 9 ) = "EXEC CICS" then do
000027 exec = space( exec tail )
000028 end
000029
000030 when left( tail, 8) = "END-EXEC" then do
000031 exec = space( exec tail )
My complete code(same as you provided):
Code: Select all
000001 do i = 1 to data.0
000002 exec = ""; iden = ""; line = ""
000003
000004 work = translate( data.i, " ", "'")
000005 work = translate( work )
000006 work = space( work )
000007
000008 parse var work head "|" tail
000009 head = strip( head )
000010 line = head "|"
000011
000012 tail = strip( tail )
000013
000014 line = head "|"
000015 say ' line : ' line
000016 say ' tail1: ' tail
000017 p = pos("(", tail )
000018 say ' p : ' p
000019 do while p > 0
000020 tail = left( tail, p-1) || substr( tail, p+1)
000021 p = pos( "(", tail )
000022 end
000023
000024 select
000025
000026 when left( tail, 9 ) = "EXEC CICS" then do
000027 exec = space( exec tail )
000028 end
000029
000030 when left( tail, 8) = "END-EXEC" then do
000031 exec = space( exec tail )
000032
000033 select
000034 when wordpos( word( exec, 3), "LINK XCTL" ) > 0 then do
000035 line = line word( exec, 3) "|"
000036 parse value(space(exec,0)) with . "PROGRAM(" iden ")" .
000037 line = line iden "|" "NA" "|" "NA" "|"
000038 end
000039
000040 when wordpos( word( exec, 3), "WRITE READ INQUIRE STARTBR ENDBR READNEXT" ) > 0 then do
000041 line = line word( exec, 3) "|"
000042 parse value(space(exec,0)) with . "FILE(" iden ")"
000043 if iden = "" then ,
000044 parse value(space(exec,0)) with . "DATASET(" iden ")" .
000045 line = line "NA" "|" iden "|" "NA" "|"
000046 end
000047
000048 when wordpos( word( exec, 3), "READQ WRITEQ" ) > 0 then do
000049 line = line word( exec, 3)
000050 line = line word( exec, 4) "|"
000051 parse value(space(exec,0)) with . "QUEUE(" iden ")" .
000052 line = line "NA" "|" "NA" "|" iden "|"
000053 end
000054
000055 otherwise do
000056 line = line "NA" "|" "NA" "|" "NA" "|"
000057 end
000058 end
000059
000060 say line
000061 exec = ""; iden = ""; line = ""
000062
000063 end
000064 otherwise do
000065 exec = space( exec tail )
000066 say ' exec : ' exec
000067 end
000068
000069 end
000070
000071 end
Code: Select all
AAAAAAAA | EXEC CICS
AAAAAAAA | LINK
AAAAAAAA | PROGRAM(WS-INVOKED-PGM)
AAAAAAAA | COMMAREA(API-COMMAREA)
AAAAAAAA | RESP (CICS-RESP)
AAAAAAAA | END-EXEC.
AAAAAAAA | EXEC CICS WRITE
AAAAAAAA | FILE (WS-LOG-FILE)
AAAAAAAA | FROM (WS-LOG-RECORD)
AAAAAAAA | LENGTH (LENGTH OF WS-LOG-RECORD)
AAAAAAAA | RIDFLD (WS-RBA)
AAAAAAAA | RBA
AAAAAAAA | RESP (CICS-RESP)
AAAAAAAA | END-EXEC.
AAAAAAAA | EXEC CICS WRITEQ TD
AAAAAAAA | QUEUE ('CSMT')
AAAAAAAA | FROM (WS-CSMT-AREA)
AAAAAAAA | NOHANDLE
AAAAAAAA | END-EXEC.
BBBBBBBB | EXEC CICS LINK PROGRAM ('XXXXXXXX' )
BBBBBBBB | COMMAREA (DSA-COMMAREA )
BBBBBBBB | LENGTH (DSA-COMMAREA-LENGTH)
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS QUEUE (TSQ2-WSD )
BBBBBBBB | INTO (TSQ-AREA )
BBBBBBBB | LENGTH (TSQ-LEN )
BBBBBBBB | ITEM (TSQ-ITEM )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS
BBBBBBBB | QUEUE (WRK-WSD )
BBBBBBBB | INTO (WRK-AREA )
BBBBBBBB | LENGTH (LENGTH OF WRK-AREA)
BBBBBBBB | ITEM (WRK-ITEM )
BBBBBBBB | END-EXEC
BBBBBBBB | EXEC CICS READ INTO (XXXX )
BBBBBBBB | LENGTH (REC-LEN )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | RESP (WS-RESP )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS STARTBR KEYLENGTH (KEY-LEN )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READNEXT INTO (CP01 )
BBBBBBBB | DATASET (CURR-FILE )
BBBBBBBB | RIDFLD (REC-KEY )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS ENDBR
BBBBBBBB | DATASET(CURR-FILE)
BBBBBBBB | END-EXEC
BBBBBBBB | EXEC CICS INQUIRE FILE (CURR-FILE )
BBBBBBBB | DSNAME (CURR-DSN )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS INQUIRE FILE (CURR-FILE )
BBBBBBBB | DSNAME (CURR-DSN )
BBBBBBBB | END-EXEC.
BBBBBBBB | EXEC CICS READQ TS QUEUE (TSQ2-WAD )
BBBBBBBB | INTO (TSQ-AREA )
BBBBBBBB | LENGTH (TSQ-LEN )
BBBBBBBB | ITEM (TSQ-ITEM )
BBBBBBBB | END-EXEC.
CCCCCCCC | EXEC CICS LINK
CCCCCCCC | PROGRAM (ID-PROGRAM)
CCCCCCCC | COMMAREA (ID-COMMAREA)
CCCCCCCC | LENGTH (ID-COMMAREA-LENGTH)
CCCCCCCC | END-EXEC.
CCCCCCCC | EXEC CICS WRITE
CCCCCCCC | FILE ('FILE1')
CCCCCCCC | FROM (FILE1-DSA)
CCCCCCCC | LENGTH (FILE1-LENGTH)
CCCCCCCC | RIDFLD (FILE1-RELATIVE-BYTE)
CCCCCCCC | RBA
CCCCCCCC | END-EXEC.
DDDDDDDD | EXEC CICS XCTL
DDDDDDDD | PROGRAM ('YYYYYYYY')
DDDDDDDD | COMMAREA (DFHCOMMAREA)
DDDDDDDD | LENGTH (WS-SUB)
DDDDDDDD | NOHANDLE
DDDDDDDD | END-EXEC.
EEEEEEEE | EXEC CICS XCTL PROGRAM (AV-XCTL-PGM)
EEEEEEEE | COMMAREA (CA-COMMAREA)
EEEEEEEE | LENGTH (IMS-COMM-FP-LEN)
EEEEEEEE | END-EXEC.
Code: Select all
AAAAAAAA | NA | NA | NA |
AAAAAAAA | NA | NA | NA |
AAAAAAAA | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
BBBBBBBB | NA | NA | NA |
CCCCCCCC | NA | NA | NA |
CCCCCCCC | NA | NA | NA |
DDDDDDDD | NA | NA | NA |
EEEEEEEE | NA | NA | NA |
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Now it's working. I'm new to REXX so trying to understand the code how it works and did not noticed it.
Thanks a lot Enrico for helping me on this.
Thanks a lot Enrico for helping me on this.
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
Hi Enrico/All,
I'm facing the issue if we have "EXEC CICS" & "END-EXEC" are on same line.
Example 1:
Input:
Example 2:
Input:
In case of example 1 output is blank but output should similar to example 2.
example 2 output:
I'm able to understand that is because, we are checking for first 8 position for END-EXEC but not able to fix it.
Can you please help me to fix this.
I'm facing the issue if we have "EXEC CICS" & "END-EXEC" are on same line.
Example 1:
Input:
Code: Select all
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.
Input:
Code: Select all
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.
example 2 output:
Code: Select all
AAAAAAA | LINK PROGRAM | WS-LOG-PRG
Code: Select all
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 )
Can you please help me to fix this.
- chavinash2004
- New Member
- Posts: 9
- Joined: Tue Mar 03, 2020 9:34 pm
Re: Rexx or SAS or Easytrive
I'm not clear with all possible scenarios initially when i post this requirement. I will take care of this in future when requesting for some help. My sincere apologize for this.
I have used this tool for many programs later i noticed this issue.
Please help me when you have free time.
Thanks for your help.
Take care.
I have used this tool for many programs later i noticed this issue.
Please help me when you have free time.
Thanks for your help.
Take care.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute