Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to convert COMP-3 value to alpha-numeric using SORT
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    Post subject: Reply to: How to convert COMP-3 value to alpha-numeric using
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    Post subject:
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 Moderator


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

PostPosted: Tue Oct 07, 2008 9:14 pm    Post subject:
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    Post subject: How can we eliminate the "C" charecter in output F
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 Moderator


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

PostPosted: Tue Oct 21, 2008 12:47 am    Post subject:
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    Post subject: Reply to: How to convert COMP-3 value to alpha-numeric using
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

Site Director


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

PostPosted: Wed Nov 19, 2008 9:13 pm    Post subject:
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 Moderator


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

PostPosted: Wed Nov 19, 2008 10:03 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us