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 

moving the sign byte in a comp-3 field to the output file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
devpal
Beginner


Joined: 06 Jul 2004
Posts: 14
Topics: 8

PostPosted: Tue Mar 22, 2005 4:48 pm    Post subject: moving the sign byte in a comp-3 field to the output file Reply with quote

Hi,

I have a s9(13)v 9(2) field in the input file. I need to move the value to the output file, but the sign should appear in the output file.

I have tried using the following options in the program, but none of them have worked.
a. i have moved the value to a temp variable in the program and declared it as S9(13)V9(2) SIGN LEADING SEPARATE. Then I have moved to this field to the output file field declared as S9(13)V9(2) SIGN LEADING SEPARATE. It shows invalid value.
b. Same as in condition a, I have declared the output file fields as S9(13)v9(2), 9(13)v9(2), x(16).

None of the above options have worked.

Please can anyone let me know how we could do this programatically.

Thanks
Devpal.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 22, 2005 9:01 pm    Post subject: Reply with quote

devpal,

I am not sure as to why you opened this topic in JCL when the question is related to application programming.

any way try this

Code:

 01 WS-IN        PIC S9(13)V9(2) COMP-3.             
 01 WS-OUT       PIC 9999999999999.99-.                                                               
 


With this definition a negative value will have "- " at the end and postive value will have space at the end.

If you do not want the leading zeroes then change the definition of WS-OUT to the following
Code:

01 WS-OUT       PIC ZZZZZZZZZZZZ9.99-.


Alternatively if you are planning to this using an utility then the following JCL will give you the desired results.

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=(P,8,PD,EDIT=(TTTTTTTTTTTTT.TTS),SIGNS=(,,+,-))
/*

replace P in the outrec fields with the start position of your comp-3 field.



If you do not want the leading zeroes then change the SYSIN cards to the following
Code:

//SYSIN   DD *                                                 
  SORT FIELDS=COPY                                             
  OUTREC FIELDS=(P,8,PD,EDIT=(IIIIIIIIIIIIT.TTS),SIGNS=(,,+,-))
/*
replace P in the outrec fields with the start position of your comp-3 field.


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
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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