Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Mar 09, 2004 12:25 pm Post subject:
Is the record in File2 always just one record with ******* or can it change to something else? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 13 May 2003 Posts: 18 Topics: 9 Location: Indore,India
Posted: Tue Mar 09, 2004 1:58 pm Post subject:
Hi Kolusu,
Your JCL worked well. Thanks for that. But I was not able to understand how it works. It would be great if you can elaborate a little on the logic of this JCL.
The slash in OUTFIL OUTREC splits an input record into two. The first has "hardcoded" string of stars and the second record has the first 80 bytes of the first file (as in your first post). _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Mar 09, 2004 2:53 pm Post subject:
prayank,
There is no complicated logic in the solution. Let me try to explain with a simple example.
Let us say you want to add a constant 'prayank' to input records at pos1. Let us say your input file is like this.Input file has 80 bytes lrecl and is fb recfm.
INPUT FILE1:
Code:
ABCD
DEFG
HIJK
you want the output as follows:
OUTPUT:
Code:
PRAYANK ABCD
PRAYANK DEFG
PRAYANK HIJK
To achieve this you will code the following sort control cards
Code:
SORT FIELDS=COPY
OUTREC FIELDS=(C'PRAYANK ', $ CONSTANT PRAYANK IN POS 1
1,80) $ COPY THE INPUT REC AS IS
But if we wanted the output in the following manner
Code:
PRAYANK
ABCD
PRAYANK
DEFG
PRAYANK
HIJK
we use the "/" symbol to start a new record.
Now your requirement is similar to the second output. so we are generating control cards similar to how you use regualarly code to add a constant.
We first take your constant file and create the dynamic control cards which will look as below.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
OUTFIL FNAMES=OUT,
OUTREC=(C'**************** ', X
C' ',/,1,80)
Now the second copy operator will take this as control cards with your actual(file1) and create the output.
Hope this helps you to understand the process here
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Mar 09, 2004 3:22 pm Post subject:
Here's a simple way to insert the string from the record using DFSORT Symbols:
Code:
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
****************
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Create DFSORT Symbols statement:
* CON1,'string'
OUTREC FIELDS=(C'CON1,''',1,40,C'''',80:X)
/*
//STEP2 EXEC PGM=ICEMAN
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAA
BBBBBBBB
CCCCCCCC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
* Use CON1 symbol to insert a record before each input record
OUTFIL OUTREC=(CON1,80:X,/,1,80)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Jul 07, 2004 3:58 am Post subject:
Hi,
My requirement is a bit different. I need to insert a separator record (say a string of hyphens '---------------------') between a pair of records as shown below.
My requirement is that I need to scan for a PAIR of records (As shown above 1- & 2- form a pair) and insert a separator line after every 1 - 2 pairs. If a pair is not available say I have 5 '1-' records followed by a '2-' record, then the separator should be inserted after the 4th '1-' record (four '1-' records - SEPARATOR - '1- & 2-' Pair).
My input file is of length 80 (RECFM=FB). Can I do this using SORT ?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum