View previous topic :: View next topic
|
Author |
Message |
Garpen
New User
Joined: 03 Jan 2007 Posts: 14 Location: Sweden
|
|
|
|
Hi again
This time I have a question about replacing one position. The position can contain hexvalues C0-C9 or D0-D9. If it's C0 or D0 I want it to be F0 and so on C9/D9 to F9
File is VB lrecl 133 |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Sort has a translate function, but is sounds like you want to make a zoned decimal number with a sign, unsigned? |
|
Back to top |
|
|
Garpen
New User
Joined: 03 Jan 2007 Posts: 14 Location: Sweden
|
|
|
|
Your assumption is correct. We receive the file from a customer who have a date stored as a signed field, now they want that data loaded into a DATE-column in DB2 |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Garpen,
This can be done using change option but you please provide 1 example by giving i/p & op .
Dont forget to tell byte postion of that field |
|
Back to top |
|
|
Garpen
New User
Joined: 03 Jan 2007 Posts: 14 Location: Sweden
|
|
|
|
Here is a record from the file :
0200000000000050201055232006103A000?00ABEH 001
It's the bold A(hex C1) I want to change, in this case to hex F1 |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi there,
Code: |
OPTION COPY
OUTFIL OUTREC=(1:1,35,
36:36,1,CHANGE=(1,C'A',C'1'),NOMATCH=(36,1),
37:37,101) |
Here I assumed that Bold A is coming at 36th byte including 4 byte of RDW. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Garpen,
Here's a DFSORT job that will do what you asked for for all of the values X'C0'-X'C9' and X'D0'-X'D9'. For negative values (D sign), we multiply the value by -1 to get a positive value and use TO=ZD to get an F sign. For positive values (C sign), we use TO=ZD to get an F sign. I assumed the byte you want to change is at position 36.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB/133)
//SORTOUT DD DSN=... output file (VB/133)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(36,1,ZD,LT,+0),
OVERLAY=(36:36,1,ZD,MUL,-1,TO=ZD,LENGTH=1)),
IFTHEN=(WHEN=NONE,OVERLAY=(36:36,1,ZD,TO=ZD,LENGTH=1))
/*
|
|
|
Back to top |
|
|
|