|
View previous topic :: View next topic
|
| Author |
Message |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Hi there,
I have the following sort card.
| Code: |
SORT FIELDS= (1,6,BI,A)
OUTFIL FNAMES=D2DOUT,INCLUDE=(117,1,CH,EQ,C'X', -
AND,118,2,CH,EQ,C'XY',AND,149,6,ZD,EQ,200000), -
OUTREC=(1:1,116)
OUTFIL FNAMES=DEVOUT,INCLUDE=(117,1,CH,EQ,C'Y'), -
OUTREC=(1:1,116) |
For D2DOUT, I am getting records such as:
200105123456702A............................
200105123456702B............................
200105123456702C............................
200105345678901X...........................
200105345678901Y...........................
200105345678901Z...........................
200105987654321X...........................
200105987654321Y...........................
200105987654321Z...........................
The file in question is FB with LRECL=116. First six bytes belong to a code and the next 9 bytes are for an account number.
As per my new requirement I need the records in red at the bottom of the file. Basically I want all the records with code = 200105 and account no = 123456702 at the bottom of my file. Other records must be sorted the way it was done before. Now can I achieve this by just modifying the existing sortcard or do I have to introduce one extra sort step? I tried searching for such an example where sorting is done only at the OUTFIL level but couldn't find anything.
Regards,
Mohit |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Use INREC with IFTHEN=(WHEN=(logexp) to identify the keys you want to outsort. Add (front or back of record, depending on variable/fixed) a byte set to a value higher than space. Sort on that byte as the major key. Remove that byte with BUILD in your OUTFILs. |
|
| Back to top |
|
 |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
may be try this logic
| Code: |
| inrec overlay 200105 to 999999 |
for the record with
| Code: |
| code = 200105 and account no = 123456702 |
do the normal sort (1,6,BI,A)
then do
| Code: |
| outrec overlay change 999999 to again 200105 |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Use the following control cards
| Code: |
//SYSIN DD *
INCLUDE COND=(117,1,CH,EQ,C'Y',OR,
(117,3,CH,EQ,C'XXY',AND,149,6,ZD,EQ,200000))
INREC IFOUTLEN=118,IFTHEN=(WHEN=INIT,OVERLAY=(118:X)),
IFTHEN=(WHEN=(1,15,CH,EQ,C'200105123456702'),OVERLAY=(118:C'1'))
SORT FIELDS=(1,6,BI,A,118,1,CH,A),EQUALS
OUTFIL FNAMES=D2DOUT,INCLUDE=(117,1,CH,EQ,C'X'),BUILD=(1,116)
OUTFIL FNAMES=DEVOUT,INCLUDE=(117,1,CH,EQ,C'Y'),BUILD=(1,116)
//* |
Knickraj,
OP needs to evaluate the full 15 bytes not just the key. So if there is another account number with the same key then it will also be pushed to the bottom. |
|
| Back to top |
|
 |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
kolusu,
i have also mention 15 bytes only.
| Code: |
Code:
inrec overlay 200105 to 999999
for the record with
Code:
code = 200105 and account no = 123456702 |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| Oops sorry overlooked the second portion. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|