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

How to convert COMP-3 value to alpha-numeric using SORT


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

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Tue Oct 07, 2008 4:08 pm
Reply with quote

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

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Tue Oct 07, 2008 4:17 pm
Reply with quote

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

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Tue Oct 07, 2008 6:12 pm
Reply with quote

Try this SORT card,

Code:

  SORT FIELDS=COPY
  INREC FIELDS=(22:22,8,PD,TO=ZD)
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: Tue Oct 07, 2008 9:14 pm
Reply with quote

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

New User


Joined: 08 May 2007
Posts: 26
Location: hyderabad

PostPosted: Tue Oct 21, 2008 12:38 am
Reply with quote

How can we eliminate the "C" charecter in output File

Example:
Output: 0000481C
Expected Output: 0000481
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: Tue Oct 21, 2008 12:47 am
Reply with quote

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

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Nov 19, 2008 2:38 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Wed Nov 19, 2008 9:13 pm
Reply with quote

Hello,

Post a few actual input values and the output values from that input.

Show the output values in hex.
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: Wed Nov 19, 2008 10:03 pm
Reply with quote

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
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top