Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to select record x+7 or x+2 based on report con

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: How to select record x+7 or x+2 based on report con
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: 2126
Location: UK

PostPosted: Wed Jan 17, 2018 5:12 pm    Post subject:
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: 2448
Location: @my desk

PostPosted: Wed Jan 17, 2018 11:51 pm    Post subject: Reply to: How to select record x+7 or x+2 based on report con
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

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Thu Jan 18, 2018 1:05 am    Post subject:
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    Post subject: Reply to: How to select record x+7 or x+2 based on report con
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    Post subject:
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: 2448
Location: @my desk

PostPosted: Thu Jan 18, 2018 3:07 am    Post subject: Re: Reply to: How to select record x+7 or x+2 based on report con
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem with OVERLAY - BI on SMF Record Ghellar DFSORT/ICETOOL 4 Sat Dec 01, 2018 9:41 pm
No new posts Propagating value from nth record to ... ganasrinivasan DFSORT/ICETOOL 7 Fri Nov 30, 2018 8:31 am
No new posts Previous record x current record jackare SYNCSORT 1 Thu Nov 29, 2018 7:56 am
No new posts Process Last Key of a record based on... naveen katkuri DFSORT/ICETOOL 5 Mon Nov 12, 2018 9:54 am
No new posts Writing multiple records into a CSV r... hiravibk DFSORT/ICETOOL 2 Wed Nov 07, 2018 2:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us