IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replacing the junk values in a field with spaces


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Aug 11, 2008 5:32 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Aug 11, 2008 5:43 pm
Reply with quote

Replacing a nonnumeric with spaces (nonnumeric) sounds like a bad idea, wouldn't zeros be a better idea!
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Aug 11, 2008 6:11 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 11, 2008 9:03 pm
Reply with quote

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
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Aug 11, 2008 9:17 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 11, 2008 9:43 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 11, 2008 9:44 pm
Reply with quote

Hello,

I believe the requirement definition needs a slight modification icon_wink.gif

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 11, 2008 9:54 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top