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

Count records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Mon Mar 21, 2011 10:24 pm
Reply with quote

Hi!

I know that DFSORT can COUNT records, and put a TEXT into a output file but I have a problem that with this:

I have this input file - named HEADERS:
Code:

0 XXXXXXXXXX
1 XXXXXXXXXX
1 XXXXXXXXXX
0 XXXXXXXXXX
1 XXXXXXXXXX
0 XXXXXXXXXX
1 XXXXXXXXXX


And this input file - named TEMPLATE:
Code:
  ALLOCATE DATASET('XXXX.SXS.FILE.G????V00') NEW REUSE CATALOG -
  LIKE('XXXX.SXS.OTHER.FILE')


I want to repeat the file TEMPLATE X times where X is the count of zeros in byte 1 of HEADERS. At the same time I need to replace string '????' by the sequence from 1 until the count of zeros in byte 1 of input file, like this.
Code:
  ALLOCATE DATASET('XXXX.SXS.FILE.G0001V00') NEW REUSE CATALOG -
  LIKE('XXXX.SXS.OTHER.FILE')                             
  ALLOCATE DATASET('XXXX.SXS.FILE.G0002V00') NEW REUSE CATALOG -
  LIKE('XXXX.SXS.OTHER.FILE')                             
  ALLOCATE DATASET('XXXX.SXS.FILE.G0003V00') NEW REUSE CATALOG -
  LIKE('XXXX.SXS.OTHER.FILE')                             


Can this be done with DFSORT?

Thank you,
Bruno Oliveira
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Mar 21, 2011 10:57 pm
Reply with quote

Bruno Oliveira,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
0 XXXXXXXXXX                                               
1 XXXXXXXXXX                                               
1 XXXXXXXXXX                                               
0 XXXXXXXXXX                                               
1 XXXXXXXXXX                                               
0 XXXXXXXXXX                                               
1 XXXXXXXXXX                                               
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  INCLUDE COND=(1,1,CH,EQ,C'0')                           
  OUTFIL BUILD=(C'ALLOCATE DATASET(''',                   
                C'XXXX.SXS.FILE.G',SEQNUM,4,ZD,C'V00''',   
                C') NEW REUSE CATALOG - ',/,               
                C'LIKE(''',                               
                C'XXXX.SXS.OTHER.FILE''',C')',80:X)       
//*
Back to top
View user's profile Send private message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Mon Mar 21, 2011 11:04 pm
Reply with quote

I didn't knew about the / !

It works like a charm. Many thanks, Skolusu!
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Format data from multiple records usi... SYNCSORT 4
No new posts count contained values of several col... DB2 5
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
Search our Forums:


Back to Top