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 

Numeric to COMP conversion

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Feb 24, 2005 12:25 pm    Post subject: Numeric to COMP conversion Reply with quote

I have onefile with layout first 4 positions are COMP type field, one space and one integer number.
..
_________________
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 24, 2005 12:53 pm    Post subject: Reply with quote

Sarangadhar,

The following JCL will convert a 4 byte comp field to 9 digit numeric field.
Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD DSN=YOUR INPUT FILE,         
//            DISP=SHR                     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  OUTREC FIELDS=(1,4,BI,EDIT=(TTTTTTTTT))   
/*   



The following JCL will convert a 9 digit numeric field to 4 byte comp field
Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD DSN=YOUR INPUT FILE,         
//            DISP=SHR                     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  OUTREC FIELDS=(1,9,ZD,BI,LENGTH=4)   
/*   


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
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Feb 24, 2005 1:13 pm    Post subject: Reply with quote

Thanks Kolusu, I fotgot to add onething to my first Q.
For converting
i/p fiel 1-9=numeric 10=space 11=numeric 12-50=space
o/p file 1-4=comp 5=space 6=numeric digit 7-50=spaces
i'm using the below and working fine.
SORT FIELDS=COPY
INREC FIELDS=(1:1,9,ZD,BI,5:10,1,6:11,1,7:12,44)


Then how to do this: (adding space end last 5 places)
i/p file 1-4=comp 5=space 6=numeric digit 7-50=spaces
o/p file 1-9=numeric 10=space 11=numeric 12-50=space
_________________
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 24, 2005 1:25 pm    Post subject: Reply with quote

Sarangadhar,


Quote:

Then how to do this: (adding space end last 5 places)
i/p file 1-4=comp 5=space 6=numeric digit 7-50=spaces
o/p file 1-9=numeric 10=space 11=numeric 12-50=space



Code your SORT Control cards as shown below

Code:

//SYSIN   DD *
   SORT FIELDS=COPY
   OUTREC FIELDS=(1:1,4,BI,EDIT=(TTTTTTTTT), $ BI TO 9 DIGITS
                  10:X,                      $ SPACE
                  11:6,1,                    $ NUMERIC FROM POS 6
                  55:X)                      $ PAD SPACE UPTO BYTE 55
/*


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
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Feb 24, 2005 1:51 pm    Post subject: Reply with quote

Thanks man. Working fine.
EDIT=(TTTTTTTTT) is like spanning into length of 9? or converting into numeric,
If I use
1:1,4,BI,ZD,LENGTH=9 for first filed its not giving correct digit at 9th place, why?
_________________
Thanks
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: Thu Feb 24, 2005 2:03 pm    Post subject: Reply with quote

A couple of comments:

A 4-byte BI value can give a maximum of 10 digits, not 9 (e.g. X'FFFFFFFF' is 4294967295 in decimal).

With DFSORT, 1,4,BI,ZD,LENGTH=9 will use an F sign for the last digit giving what I think you mean by "a correct digit". With Syncsort, 1,4,BI,ZD,LENGTH=9 will use a C sign for the last digit, giving what I think you mean by "an incorrect digit". So if you're getting an incorrect digit, you must be using Syncsort. Note that both F and C are valid ZD signs, but only F is displayable/printable.

For both products, EDIT=(TTTTTTTTT) gives 9 digits with an F sign for the last digit. TO=ZD,LENGTH=9 handles negative values (D sign). EDIT=(TTTTTTTTT) treats negative values as positive values (F sign).

Note that with DFSORT's Dec, 2004 PTF, you can now use ZDC to tell DFSORT to use a C sign or ZD or ZDF to tell DFSORT to use an F sign.
_________________
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
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Mar 03, 2005 1:10 am    Post subject: Reply with quote

Thanks Kolusu & Frank.
_________________
Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
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