|
View previous topic :: View next topic
|
| Author |
Message |
JoAnn Kulcyk
New User
Joined: 13 Jan 2018 Posts: 3 Location: USA
|
|
|
|
I am trying to select records from a report showing the output of CA-7 LJOB commands. If the job listed is found ("Request Completed", below), I want the 7th line after the command line in the report (or the second line before the "Request Completed"). If not, I want the "NOT FOUND" line. Here is a sample of a report:
| Code: |
18016 110057 LJOB,LIST=AGJOB,JOB=xxxxxxx --> I want the 7th line after this (starting with xxxxxxx, below)
LJOB,LIST=AGJOB,JOB=xxxxxxx
JOB=xxxxxxx LIST=AGJOB
JOB ----JCL---- SYSTEM USR MAIN PROSE
NAME ID MEMBER -NAME- -ID -ID- DSNBR
xxxxxxx nnn xxxxxxx ssssss 000 iii nnnnnn
SLIA-00 REQUEST COMPLETED AT 11:00:57 ON 18.016
18016 110057 LJOB,LIST=AGJOB,JOB=JMKJOB
SLIA-02 JOB=JMKJOB NOT FOUND. --> I want this line. |
Commands listing valid jobs and "not found" jobs are interspersed randomly. There is no common value to key off of on the xxxxxxx nnn xxxxxxx ssssss 000 iii nnnnnn lines I need to select.
Can I do this with Syncsort? I can successfully key the output into groups, but I'm not sure what this buys me, if anything. Thanks! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
That lne looks like the 12th - you have failed to count blank lines which are still lines..
In your input phase try GOUPing and assigning a sequence number and on your output phase selecting only those lines with the sequence number relating to your required line (12).
And plaease use the code tags when posting stuff that requires a fixed pitch font. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Looks like line-13 when counted in notepad. I don't have access to the tool, so really not sure if those blank lines really do exist in the actual data.
JoAnn Kulcyk,
Welcome to the forums. As Nic has pointed above, please use Code tags while posting code/data.
Do you need to create 2 outputs - jobs found/jobs not found?
If it is just one output, Nic has already given a hint, use WHEN=GROUP to identify groups BEGINning with 'LJOB' and assign (PUSH) SEQuence numbers to records in each group.
While writing to the output use OUTFIL INCLUDE to
select only records with sequence number = 13
OR
(sequence number =3 AND has 'NOT FOUND')
Good luck |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2275 Location: USA
|
|
|
|
| Code: |
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,80,SS,EQ,C' LJOB,LIST='), detect group
PUSH=(81:SEQ=4)) renumber lines within group
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,7,CH,EQ,C'SLIA-02', select "not found" line
OR,81,4,CH,EQ,C'0008'), select line #8 after 'group header'
BUILD=(1,80)
END |
|
|
| Back to top |
|
 |
JoAnn Kulcyk
New User
Joined: 13 Jan 2018 Posts: 3 Location: USA
|
|
|
|
Thanks for your help. This is what worked:
| Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(21,4,CH,EQ,C'LJOB'),
PUSH=(100:SEQ=3))
SORT FIELDS=COPY,
DYNALLOC=(,5)
OUTFIL INCLUDE=(100,3,CH,EQ,C'008',
OR,(100,3,CH,EQ,C'003',AND,23,9,CH,EQ,C'NOT FOUND')) |
|
|
| Back to top |
|
 |
JoAnn Kulcyk
New User
Joined: 13 Jan 2018 Posts: 3 Location: USA
|
|
|
|
I have now simplified it to:
| Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(21,4,CH,EQ,C'LJOB'),
PUSH=(100:SEQ=3))
SORT FIELDS=COPY,
DYNALLOC=(,5)
OUTFIL INCLUDE=(100,3,CH,EQ,C'008',
OR,23,9,CH,EQ,C'NOT FOUND'),
BUILD=(1,80) |
Thanks again for your help! |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| JoAnn Kulcyk wrote: |
Thanks for your help. This is what worked:
|
Good job |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|