|
View previous topic :: View next topic
|
| Author |
Message |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
Hi,
I need a SORT job that convert the character to numeric. Following is my scenario.
Input File:
CHAR(5) 1-5
CHAR(5) 6-10 (it will contain numeric values alone no non-numeric value)
CHAR(5)11-15
| Code: |
AAAAA12345XXXXX
BBBBB05456YYYYY
CCCCC00518ZZZZZ
DDDDD00015WWWWW
EEEEEE00007YYYYY |
Expected Output:
| Code: |
AAAAA12345XXXXX
BBBBB5456bYYYYY
CCCCC518bbZZZZZ
DDDDD015bbWWWWW
EEEEEE007bbYYYYY |
The 'b' ---> denotes blank space.
I want to convert input field to be converted to numeric field with leading zeros for values for all three digit values alone. and for four digit it should be left justified with space in the last bit , for five digit it has to come as it is. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
is this correct?
6-10 contains a non numeric value.
Gerry |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
Sorry its EEEEE00007YYYYY...
Input File:
CHAR(5) 1-5
CHAR(5) 6-10 (it will contain numeric values alone no non-numeric value)
CHAR(5)11-15
AAAAA12345XXXXX
BBBBB05456YYYYY
CCCCC00518ZZZZZ
DDDDD00015WWWWW
EEEEE00007YYYYY
Expected Output:
AAAAA12345XXXXX
BBBBB5456bYYYYY
CCCCC518bbZZZZZ
DDDDD015bbWWWWW
EEEEE007bbYYYYY
b ---> denotes blank space. |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
ADDED TO THAT EXAMPLE
i/p
EEEEE00000YYYYY
o/p
EEEEE000bbYYYYY
Will this sort card work...
OUTREC FIELDS=(1,5,6,5,ZD,TO=ZD,(EDIT=III),length=5) |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| Will this sort card work... |
What happens when you run this? |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
what happens when you try it ?
Gerry |
|
| Back to top |
|
 |
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
| lasiafjmc, please use BBCode (see FAQ). |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
| Thanks |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
lasiafjmc,
Use the following DFSORT JCL which will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(6:6,5,UFF,M10,LENGTH=5,6:6,5,JFY=(SHIFT=LEFT))),
IFTHEN=(WHEN=(8,3,CH,EQ,C' ',AND,7,1,CH,GT,C' '),
OVERLAY=(7:6,2,6:C'0')),
IFTHEN=(WHEN=(7,4,CH,EQ,C' ',AND,6,1,CH,GT,C' '),
OVERLAY=(8:6,1,6:2C'0'))
//* |
|
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
| Thanks Let me check |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
| Thanks it working Super... |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
I am getting the output as
0EW3 000
1AAAA12345XXXXX
1BBBB5456 YYYYY
1CCCC518 ZZZZZ
1DDDD015 WWWWW
1EEEE007 YYYYY
1EEEE000 YYYYY
957DD000
. How to remove the 000 in header and trailer... Please help me |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| lasiafjmc wrote: |
| How to remove the 000 in header and trailer... Please help me |
You never shown you have header and trailer also... This is first time you are revealing after Kolusu has spent time for your solution. |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
| Oh sorry |
|
| Back to top |
|
 |
lasiafjmc
New User
Joined: 01 Jul 2009 Posts: 9 Location: india
|
|
|
|
I/p file:
--------
0EW3
1AAAA12345XXXXX
1BBBB05456YYYYY
1CCCC00518ZZZZZ
1DDDD00015WWWWW
1EEEE00007YYYYY
1EEEE00000YYYYY
957DD
Expected Output:
--------------------
0EW3
1AAAA12345XXXXX
1BBBB5456 YYYYY
1CCCC518 ZZZZZ
1DDDD015 WWWWW
1EEEE007 YYYYY
1EEEE000 YYYYY
957DD
record starting with 0 & 9 are header and trailer... |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
lasiafjmc,
*Sigh* Use the following control cards
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,1,ZD,EQ,1),
OVERLAY=(6:6,5,UFF,M10,LENGTH=5,6:6,5,JFY=(SHIFT=LEFT)),HIT=NEXT),
IFTHEN=(WHEN=(8,3,CH,EQ,C' ',AND,7,1,CH,GT,C' ',AND,1,1,ZD,EQ,1),
OVERLAY=(7:6,2,6:C'0')),
IFTHEN=(WHEN=(7,4,CH,EQ,C' ',AND,6,1,CH,GT,C' ',AND,1,1,ZD,EQ,1),
OVERLAY=(8:6,1,6:2C'0'))
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|