Page 1 of 1

Insert a "countfield"

PostPosted: Thu May 12, 2011 5:00 pm
by LasseH
Is it possible to "insert" a countfield (with ; after) first in each record

Input:
aaa;bbb;ccc;
aaa:bbb:ddd:

output:
000001;aaa;bbb;ccc;
000002;aaa;bbb;ddd;

//Lasse

Re: Insert a "countfield"

PostPosted: Thu May 12, 2011 10:01 pm
by skolusu
LasseH,

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

//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD *                         
----+----1----+----2----+----3----+----4
AAA;BBB;CCC;                           
AAA:BBB:DDD:                           
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                         
  SORT FIELDS=COPY                     
  INREC BUILD=(SEQNUM,6,ZD,C';',1,12)   
//*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: Insert a "countfield"

PostPosted: Fri May 13, 2011 4:10 pm
by LasseH
That did it. tnkx