View previous topic :: View next topic
|
Author |
Message |
dilipbiradar
New User
Joined: 12 Jan 2007 Posts: 18 Location: Pune (India)
|
|
|
|
Thanks in advance!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It is not clear what you are asking.
Post some sample existing data and how you want it to be to meet your requirement. |
|
Back to top |
|
|
dilipbiradar
New User
Joined: 12 Jan 2007 Posts: 18 Location: Pune (India)
|
|
|
|
I have following records for each Account Number
Code: |
Account Number1 A 321
Account Number1 B 124
Account Number1 C 453
Account Number1 D 101
Account Number1 D 901
Account Number2 A 321
Account Number2 B 124
Account Number2 C 453
Account Number2 D 101
Account Number2 D 901
|
I need to copy this file in the new file but I want the D type reord reversed i. e. D101 must come after D901, I have put sample data, I dont see any field on which I can sort the same.
Please help !! Thanks !!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
How complete is the sample data? From the data posted, you could sort the account number and the alpha field ascending and the 3-digit field descending and this would invert the 101/901 entries. |
|
Back to top |
|
|
dilipbiradar
New User
Joined: 12 Jan 2007 Posts: 18 Location: Pune (India)
|
|
|
|
Scenario is I am not supposed to change the sequence of the remaining records other than D
Code: |
Account Number1 C 321
Account Number1 A 124
Account Number1 B 453
Account Number1 D 101
Account Number1 D 901
Account Number2 C 21
Account Number2 A 124
Account Number2 B 453
Account Number2 D 101
Account Number2 D 901
|
Thanks!!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Sorry - didn't realize that the "other" data needed to stay in the same sequence. . . |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If this is a VSAM KSDS file, the key sequence defined in IDCAMS will be used no matter what you want. You can read the data out of the VSAM file, sort it any way you want, and proceed -- but the data sequence in the file is based on the key definition. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Do the fields that you want to change constitute part of the record key ? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
dilipbiradar,
Assuming the output file is NOT a KSDS and the VSAM input file has fixed-length 21 byte records, you can use a DFSORT job like the following to do what you asked for. The job could be changed appropriately if the length of the records is not 21 bytes.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input file w/21-byte records
//SORTOUT DD DSN=... output file
//SYSIN DD *
RECORD TYPE=F
INREC IFTHEN=(WHEN=INIT,OVERLAY=(22:SEQNUM,8,ZD,
30:SEQNUM,8,ZD,START=0,RESTART=(17,1))),
IFTHEN=(WHEN=(17,1,CH,EQ,C'D'),
OVERLAY=(22:22,8,ZD,SUB,30,8,ZD,TO=ZD,LENGTH=8))
SORT FIELDS=(22,8,ZD,A,19,3,CH,A)
OUTREC BUILD=(1,21)
/*
|
|
|
Back to top |
|
|
|