View previous topic :: View next topic
|
Author |
Message |
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi,
I have an input file with the following details.
Filed Name:Test-ID
Length/Type: 8/PS
Position: 22-29
I need to move the value of Test-ID to a filed which is declared as X(15).
my output field position starts from 22.
Can somebody let me know how to do this using SORT.
Thanks in advance. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi,
Sorry my O/P file filed declaration is X(15) ( not X(16) )In order to be more clear I am giving the hex value of I/P file.
j
00000592
0000481C
and I need the O/P value as
000000000458912 and my O/P filed declaration is X(15).
Thanks. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
Try this SORT card,
Code: |
SORT FIELDS=COPY
INREC FIELDS=(22:22,8,PD,TO=ZD)
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
chinnielr,
Here's a DFSORT job that will do what I think you asked for. I assumed your input file has RECFM=FB and LRECL=80 and you want to keep the rest of the bytes in the record while expanding the PD field. You can change the job appropriately if needed. If you need more specific help, give complete details about what you want for the output records and I'll show you how to change the job.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/87)
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,21,22:22,8,PD,TO=ZD,LENGTH=15,
30,51)
/*
|
|
|
Back to top |
|
|
Laxminarsimharao
New User
Joined: 08 May 2007 Posts: 26 Location: hyderabad
|
|
|
|
How can we eliminate the "C" charecter in output File
Example:
Output: 0000481C
Expected Output: 0000481 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
X'0000481C' is a 4-byte positive PD value. If you want to convert it to 7 character displayable value, you can use DFSORT control statements something like this:
Code: |
OPTION COPY
INREC BUILD=(1,4,PD,TO=ZD,LENGTH=7)
|
or this:
Code: |
OPTION COPY
INREC BUILD=(1,4,PD,EDIT=(TTTTTTT))
|
If you want something else, explain more clearly what you want. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi Frank,
Thanks for the reply.
If I need the reverse way i.e., Alpha-numeric to COMP-3.
Will the below sort works?
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/87)
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,21,22:22,15,ZD,TO=PD,LENGTH=8,
30,51)
/*
|
When I tried the above sort I am getting junk values in the O/P?
Please suggest a solution for this.
Thanks and regards,
Chinni. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Post a few actual input values and the output values from that input.
Show the output values in hex. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Chinni,
I don't know what you mean by "junk values".
22:22,15,ZD,TO=PD,LENGTH=8 would give you an 8-byte PD value starting at position 22. So if you had 123456789012345 as input in that field, you would get X'123456789012345C' as output for that field.
I notice you have 30,51 - that would start copying characters in the middle of your 22,15 field. I think you actually want 37,44 if you want a 73-byte output record or 37,44,80:X if you want an 80-byte output record.
If that doesn't help, then you need to show an example of your input records and the corresponding "junk" produced in the output records . |
|
Back to top |
|
|
|