|
View previous topic :: View next topic
|
| Author |
Message |
vpalanivelu
New User

Joined: 24 Feb 2009 Posts: 14 Location: chennai
|
|
|
|
Input File -1
| Code: |
153
155
160
17
0
1
2 |
output File-1
| Code: |
00153
00155
16000
00017
00000
00001
20000
|
1. If It is a ODD number , gotta include leading zeros
2. if it is a EVEN number , gotta incluide trailing zeros,for zero - 00000
3. Lenght should be = 5 |
|
| Back to top |
|
 |
genesis786
Active User

Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
i tried this.. worked for me..
| Code: |
SORT FIELDS=COPY
INREC FIELDS=(1,5,X,1,5,UFF,M10)
OUTFIL IFTHEN=(WHEN=(11,1,SS,EQ,C'1 3 5 7 9'),
BUILD=(1,5,UFF,M11)),
IFTHEN=(WHEN=(11,1,SS,EQ,C'0 2 4 6 8'),
BUILD=(1,5,ZD,M11))
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Vaasuki,
You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
153
155
160
17
0
1
2
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
OVERLAY=(81:1,5,UFF,MOD,+2,M11,LENGTH=1)),
IFTHEN=(WHEN=(81,1,CH,EQ,C'1'),
OVERLAY=(1:1,5,UFF,M11,LENGTH=5)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,5,ZD,M11,LENGTH=5))
/*
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|