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
 
is it possible to put record counts out with sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
haleyja

New User


Joined: 09 Mar 2006
Posts: 15

PostPosted: Tue May 30, 2006 8:09 pm    Post subject: is it possible to put record counts out with sort
Reply with quote

Code:

//S1    EXEC  PGM=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD DSN=...  input file (FB/133)                 
//SORTOUT DD DSN=...  output file (FB/133)           
//SYSIN    DD    *                                   
  OPTION COPY                 
* If conditions are met, write entire record.                       
  INREC IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,     
       20,8,CH,EQ,C'IRR010I ',OR,                     
       18,11,CH,EQ,C'  ICH70001I',OR,                 
       20,6,CH,EQ,C'$HASP3'),                         
    BUILD=(1,133)),                   
* If conditions are not met, write placeholder record.               
  IFTHEN=(WHEN=NONE,BUILD=(C'!@#')) 



I'm testing this code from Frank and it works perfectly but I'm wondering if its possible to put out the record count on every line put out and does sort know the name of the file its reading to put it out too with the record count. I know this is possible in Fileaid but can't find this in the docs yet.

Thanks

James
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue May 30, 2006 9:04 pm    Post subject:
Reply with quote

Quote:
I'm wondering if its possible to put out the record count on every line put out


If by "the record count", you mean a sequence number, you can use DFSORT's SEQNUM parameter for that, e.g., SEQNUM,8,ZD

If you want more specific help you need to give the details of how you want the output records to look and exactly what you mean by "the record count". Do you want the seqnum of the original input records, or only the output records, or what? Or do you mean something different by "the record count"?

Quote:
does sort know the name of the file its reading


No.
Back to top
View user's profile Send private message
haleyja

New User


Joined: 09 Mar 2006
Posts: 15

PostPosted: Wed May 31, 2006 1:00 am    Post subject:
Reply with quote

I guess what I mean is the sequence number of the original file. Like that example above. if I find the record I output it whole and if the record doesn't match I still output a marker but I want the sequence number from the original file for the whole record or the place holder. If that makes any sense. icon_smile.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed May 31, 2006 1:10 am    Post subject:
Reply with quote

Here's a revised DFSORT job that has the sequence number of the original input record at the end of each record:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/133)
//SORTOUT DD DSN=...  output file (FB/141)
//SYSIN    DD    *
  OPTION COPY
* Add seqnum at end of each record.
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
* If conditions are met, write entire record and seqnum.
  IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,
       20,8,CH,EQ,C'IRR010I ',OR,
       18,11,CH,EQ,C'  ICH70001I',OR,
       20,6,CH,EQ,C'$HASP3'),
    BUILD=(1,133,134:134,8)),
* If conditions are not met, write placeholder record and seqnum.
  IFTHEN=(WHEN=NONE,BUILD=(C'!@#',134:134,8))
/*
Back to top
View user's profile Send private message
haleyja

New User


Joined: 09 Mar 2006
Posts: 15

PostPosted: Thu Jun 01, 2006 12:29 am    Post subject:
Reply with quote

when using this

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/133)
//SORTOUT DD DSN=...  output file (FB/141)
//SYSIN    DD    *
  OPTION COPY
* Add seqnum at end of each record.
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
* If conditions are met, write entire record and seqnum.
  IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,
              20,6,CH,EQ,C'$HASP3'),
    BUILD=(1,133,134:134,8))
* If conditions are not met, write placeholder record and seqnum.
*  IFTHEN=(WHEN=NONE,BUILD=(C'!@#',134:134,8))


How would I modify this so that just the ones i'm searching for like JES2 or Hasp go into the output file with the sequence number for its original position in the input file. I don't want the second build. I tried to remove it but then I get all records.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jun 01, 2006 1:00 am    Post subject:
Reply with quote

That's easier. This DFSORT job will do it:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/133)
//SORTOUT DD DSN=... output file (FB/141)
//SYSIN    DD    *
  OPTION COPY
* Add sequence number.
  INREC OVERLAY=(134:SEQNUM,8,ZD)
* Select desired records.
  OUTFIL INCLUDE=(18,15,SS,EQ,C' J E S 2',OR,
  20,6,CH,EQ,C'$HASP3')
/*
Back to top
View user's profile Send private message
haleyja

New User


Joined: 09 Mar 2006
Posts: 15

PostPosted: Fri Jun 02, 2006 1:05 am    Post subject:
Reply with quote

Thanks again Frank...
Back to top
View user's profile Send private message
haleyja

New User


Joined: 09 Mar 2006
Posts: 15

PostPosted: Sat Jul 15, 2006 5:26 am    Post subject:
Reply with quote

Frank,

I've been playing with the above code trying to put the sequence number in the first 7 bytes of the record and the rest of the record after the 7 bytes using this code... its a modification of the other you gave me.
But it keeps overlaying the first 7 bytes of the record... what am I doing wrong..

OPTION COPY
* ADD SEQUENCE NUMBER.
INREC OVERLAY=(1:SEQNUM,7,ZD)
* SELECT DESIRED RECORDS.
OUTFIL INCLUDE=(18,15,SS,EQ,C' J E S 2',OR,
15,18,CH,EQ,C'JOB EXECUTION DATE',OR,
15,18,CH,EQ,C'MINUTES EXECUTION TIME',OR,
20,05,CH,EQ,C'$HASP'),
BUILD=(1:1,125,126:126,8)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Jul 15, 2006 6:12 am    Post subject:
Reply with quote

Quote:
it keeps overlaying the first 7 bytes of the record


Yes, that's what you told it to do with

Code:

  INREC OVERLAY=(1:SEQNUM,7,ZD)


If you want to add the seqnum in positions 1-7 and put the rest of the record after that, you need to use BUILD, not OVERLAY

Code:

   INREC BUILD=(1:SEQNUM,7,ZD,8:1,...)
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

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