MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert from Packed decimal to numeric using sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Fri Jul 11, 2003 7:20 am    Post subject: Convert from Packed decimal to numeric using sort Reply with quote

Hi,

We need to convert a PIC S9(09) COMP field to PIC 9(09). How can we do it by SORT?

I believe that this can be achieved by using OUTREC statement and I tried the following:

SORT FIELDS = COPY
OUTREC FIELDS = (1,4,PD,ZD)

but the last byte of the field in the output file is containing the sign bit whereas I do not want it.

Any pointers? we are using SYNCSORT at our shop

regards,
Novice
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Fri Jul 11, 2003 8:51 am    Post subject: Reply with quote

Novice,


PIC S9(09) COMP is BINARY or FI(fixed point binary) field but not a packed decimal, so change your sort cards to the following and you will get the desired results.


Code:

 SORT FIELDS=COPY
 OUTREC FIELDS = (1,4,BI,EDIT=(TTTTTTTTT))


Hope this helps....

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Sun Jul 13, 2003 10:10 pm    Post subject: Reply with quote

Thanks Kolusu! It was a typo eror. My requirment was to change from Packed decimal to numeric. So what should be the control card?
Sorry for the incorrect data entered and also thanks for your time.

regards,
Novice
Back to top
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Sun Jul 13, 2003 11:37 pm    Post subject: Reply with quote

Code:

  SORT   FIELDS=COPY
  OUTREC FIELDS=(1,4,PD,EDIT=(TTTTTTTTT))
Back to top
View user's profile Send private message Send e-mail
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Mon Jul 14, 2003 10:55 pm    Post subject: Reply with quote

Thanks Prem kumar and kolusu!

regards,
Novice
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Aug 18, 2004 10:24 am    Post subject: Reply with quote

Kolusu,
My input record is like this:
2004-01-09-00:00:18 970011069 210000019 2003-12-03 269.

I wanto to convert 970011069 into Binary and 210000019 into packed decimal.
And full record should come in the input.i.e. other two date fields mentioned in the input record should be same at the output.

How can I do this.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Wed Aug 18, 2004 10:50 am    Post subject: Reply with quote

Paneendra,

The ZD fileds you have shown are of 9 bytes length each. what is the length of the binary and packed decimal fields in your output?

When converted to binary it will result in 4 bytes and 5 bytes for packed decimal. Do you want to pad binary zeroes and make the length as 9 bytes?


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Aug 18, 2004 10:54 am    Post subject: Reply with quote

Koulsu,
Length of Binary field should be 4 and Packed decimal field lenght should be 6.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Wed Aug 18, 2004 11:10 am    Post subject: Reply with quote

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
----+----1----+----2----+----3----+----4----+----5----+
2004-01-09-00:00:18 970011069 210000019 2003-12-03 269.           
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD * 
  SORT FIELDS=COPY                 
  OUTREC FIELDS=(01,20           
                 21,09,ZD,BI,   
                 30,01,         
                 31,9,ZD,PD,LENGTH=6,
                 40,16)         
/*


The explanation of the sort cards is:

Code:

01,20                 $ FIRST 20 BYTES AS IS               
21,09,ZD,BI,          $ CONV 9 BYTES ZD TO 4 BYTE BINARY
30,01,                $ 30TH BYTE AS IS                   
31,9,ZD,PD,LENGTH=6,  $ CONV 9 BYTES ZD TO 6 BYTE PACKED DECIMAL
40,16)                $ REST OF THE FIELDS


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Aug 18, 2004 12:26 pm    Post subject: Reply with quote

For some more information on DFSORT's numeric conversion features, see "Reformatting Features" - "Reformatting: Numeric Conversion" in "Beyond Sorting" at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/beyond_sorting/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Fri Aug 25, 2006 1:04 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Aug 19, 2004 12:00 am    Post subject: Reply with quote

Thanks Kolusu,
Code is working fine.
Back to top
View user's profile Send private message Send e-mail
gharisankar
Beginner


Joined: 10 Jul 2004
Posts: 19
Topics: 3
Location: C/O Platform - Mainframe

PostPosted: Mon Dec 27, 2004 5:49 pm    Post subject: Reply with quote

Interesting !!!
Hi Ravi,
It seems if we mention more that 9 bytes (02,10,ZD,BI,) it won't work.
try the below control card.
SORT FIELDS=COPY
OUTREC FIELDS=(01,01,
02,5,ZD,BI,
07,5,ZD,BI,
Laughing 12,03,
15,10,
25,10,
35,5,ZD,BI,
40,5,ZD,BI,
45,03,
48,5,ZD,BI,
53,5,ZD,BI,
58,5,ZD,BI,
63,5,ZD,BI,
68,4,ZD,BI)
The binary field occupies 4 bytes, I think if we mention 10 bytes the 'HIGH VALUES" will be moved to the output fields ..
Please correct me if I am wrong.
Rolling Eyes
_________________
Regards
Hari Smile
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 27, 2004 7:41 pm    Post subject: Reply with quote

For those who use DFSORT:

Note that with z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (available now), you can now convert larger ZD, PD, FS, FI and BI fields: up to 31 bytes for ZD, up to 16 bytes for PD, up to 32 bytes for FS, and up to 8 bytes for FI and BI. So p,10,ZD,BI will work just fine.

For complete information on all of the new DFSORT and ICETOOL functions available with these PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Dec 28, 2004 11:55 am    Post subject: Reply with quote

ravi,

When you convert a zoned decimal to binary , the deafult length of the binary field is 8 bytes. did you change your copy book accordingly?

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group