View previous topic :: View next topic |
Author |
Message |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Thu Aug 02, 2007 1:23 am Post subject: Removing leading zeroes |
|
|
I have one file with 5 bytes length
5 bytes will contain numeric data as
Code: |
00003
00100
00055
01258
|
I want to take this as input file in
icetool and get output as
Can anybody help me with the code. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Aug 02, 2007 7:08 am Post subject: |
|
|
psmadhusudhan,
Try this DFSORT job. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's JFY function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
www.ibm.com/servers/storage/support/software/sort/mvs/peug/
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00003
00100
00055
01258
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(1,05,JFY=(SHIFT=LEFT,PREBLANK=C'0',LENGTH=5))
/*
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Last edited by kolusu on Mon Apr 28, 2008 4:08 pm; edited 1 time in total |
|
Back to top |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Thu Aug 02, 2007 8:43 am Post subject: |
|
|
Thanks Kolusu _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
sushma4satya Beginner
Joined: 04 Nov 2005 Posts: 14 Topics: 4
|
Posted: Mon Apr 28, 2008 3:15 pm Post subject: |
|
|
Kolusu,
I used the below code for the below records.
0000107218
0000107768
0000107768
0000107652
0000107652
Iam getting the output as
17218
17768
17768
17652
17652
but i expected the o/p as
107218
107768
107768
107652
107652
Could you suggest me the changes in the code.
Thanks
Satya |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Apr 28, 2008 4:05 pm Post subject: |
|
|
sushma4satya,
I am sorry. Here is the updated job which would give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0000107218
0000107768
0000107768
0000107652
0000107652
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(1,10,JFY=(SHIFT=RIGHT))),
IFTHEN=(WHEN=INIT,OVERLAY=(1,10,ZD,M10,LENGTH=10)),
IFTHEN=(WHEN=INIT,OVERLAY=(1,10,JFY=(SHIFT=LEFT)))
//*
|
_________________ Kolusu
www.linkedin.com/in/kolusu
Last edited by kolusu on Thu Feb 11, 2010 12:32 pm; edited 1 time in total |
|
Back to top |
|
 |
sushma4satya Beginner
Joined: 04 Nov 2005 Posts: 14 Topics: 4
|
Posted: Tue Apr 29, 2008 1:56 pm Post subject: |
|
|
Thanks Kolusu.
One more question.
If my i/p file has :
0000107139
0000107139
000107666A
000107666A
I need o/p as :
000107139 ( Should suppress first leading zero if i/p rec has 4 zeros)
000107139 ( Should suppress first leading zero if i/p rec has 4 zeros)
000107666A( Should remain intact if i/p rec has 3 zeros)
000107666A( Should remain intact if i/p rec has 3 zeros)
Could you please suggest.
Thanks
Satya |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Apr 29, 2008 3:13 pm Post subject: |
|
|
sushma4satya,
What about other conditions when the input has 10,9,8,7,6,5,2,1 zeros ? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
sushma4satya Beginner
Joined: 04 Nov 2005 Posts: 14 Topics: 4
|
Posted: Tue Apr 29, 2008 3:20 pm Post subject: |
|
|
The only condition we have is if first 4 bytes in i/p has zeroes then we need to suppress the first leading zero for all other cases then we should not disturb that field.
i/p:
0000107139
0000107139
000107666A
000107666A
1000007888
2000007888
o/p
000107139
000107139
000107666A
000107666A
1000007888
2000007888
Thanks
Satya |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Apr 29, 2008 3:36 pm Post subject: |
|
|
sushma4satya,
try the following control cards
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'0000',AND,5,1,ZD,NE,0),
OVERLAY=(1:2,3,5,6,X))
/* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
sushma4satya Beginner
Joined: 04 Nov 2005 Posts: 14 Topics: 4
|
Posted: Wed Apr 30, 2008 10:20 am Post subject: |
|
|
Thanks Kolusu..this helped me. |
|
Back to top |
|
 |
|
|