IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to select record x+7 or x+2 based on report con


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
JoAnn Kulcyk

New User


Joined: 13 Jan 2018
Posts: 3
Location: USA

PostPosted: Tue Jan 16, 2018 10:49 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jan 17, 2018 5:12 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jan 17, 2018 11:51 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Jan 18, 2018 1:05 am
Reply with quote

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
View user's profile Send private message
JoAnn Kulcyk

New User


Joined: 13 Jan 2018
Posts: 3
Location: USA

PostPosted: Thu Jan 18, 2018 1:27 am
Reply with quote

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
View user's profile Send private message
JoAnn Kulcyk

New User


Joined: 13 Jan 2018
Posts: 3
Location: USA

PostPosted: Thu Jan 18, 2018 2:57 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Jan 18, 2018 3:07 am
Reply with quote

JoAnn Kulcyk wrote:
Thanks for your help. This is what worked:
Good job
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top