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

is it possible to put record counts out with sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue May 30, 2006 9:04 pm
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
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 Developer


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

PostPosted: Wed May 31, 2006 1:10 am
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
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 Developer


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

PostPosted: Thu Jun 01, 2006 1:00 am
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
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
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 Developer


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

PostPosted: Sat Jul 15, 2006 6:12 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
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 JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top