View previous topic :: View next topic
|
Author |
Message |
vvmanyam
New User
Joined: 16 Apr 2008 Posts: 86 Location: Bangalore
|
|
|
|
Hi,
I have an input vsam file which is of 80 bytes length
with following feilds
KEY - X(07)
Filler- X(01)
QTY - S9(07) COMP-3
Rest all the feilds is spaces.
I need to check weather the qty feilds is not numeric, and replace with spaces.
Ex:
Code: |
0001963 ...@
0001963 ...<
0002035
0002043 ...<
|
Basically for the third record we have some junk value(non numeric value) which should be replaced with zeroes.
Hope I am clear
Thanks,
Balu |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Replacing a nonnumeric with spaces (nonnumeric) sounds like a bad idea, wouldn't zeros be a better idea! |
|
Back to top |
|
|
vvmanyam
New User
Joined: 16 Apr 2008 Posts: 86 Location: Bangalore
|
|
|
|
I am sorry
Quote: |
I need to check weather the qty feild is not numeric, and replace with spaces |
I need to replace with zeroes if any non numeric is there in that comp-3 field.
Code: |
OPTION COPY
OUTREC OVERLAY=(84,4,TRAN=ALTSEQ)
ALTSEQ CODE=(40F0)
|
I have tried giving this but not sucessful
One more thing is
I need to change in that VSAM file itself,
can this be done in a single step.
Thanks,
Balu |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post the sample data in HEX. It appears as though there are valid packed-decimal numbers and the problem may be understanding them. |
|
Back to top |
|
|
vvmanyam
New User
Joined: 16 Apr 2008 Posts: 86 Location: Bangalore
|
|
|
|
Hi,
Please find the sample data with hex values
Code: |
0001963 ...@
FFFFFFF 0017
0001963 000C
0002035
FFFFFFF 4444
0002035 0000
0002043 ....
FFFFFFF 0000
0002043 000C
|
for key 0002035
the value is spaces, I want to replace with zero qty
Thanks,
Balu |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will make the change you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
RECORD TYPE=F
INREC IFTHEN=(WHEN=(9,4,PD,NE,NUM),OVERLAY=(9:X'0000000C'))
/*
|
Quote: |
One more thing is
I need to change in that VSAM file itself,
can this be done in a single step. |
Yes, it can be done in a single step (with ICETOOL) but not in a single pass which is what I think you're really asking. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe the requirement definition needs a slight modification
When the field is spaces, packed decimal zeros should be moved to the field. Might there be any other invalid value(s) or are spaces the only problem value? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Basically for the third record we have some junk value(non numeric value) which should be replaced with zeroes. |
Although the requirement was a bit unclear, I guessed from all that was said that any non-numeric value should be replaced by a PD 0, and that's how I coded my solution. Obviously, blanks is a subset of that and will be taken care of by my solution.
If blanks is the only value that should be replaced by zeros, then this INREC statement could be used:
Code: |
INREC IFTHEN=(WHEN=(9,4,CH,EQ,C' '),OVERLAY=(9:X'0000000C'))
|
|
|
Back to top |
|
|
|