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

Hardcoded negative sign value in output


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Fri Sep 08, 2017 5:28 am
Reply with quote

Hi,
Appreciate your solution to achieve the result,kindly help.

Input file format:
Accountnumber : 8 digit Numeric
location : 10 digit Aplhanumeric
Ex: 87818813MICHIGANST

Output:
Accountnumber : 8 digit Numeric
Value1 : Numeric with negative sign(S9(8)) - hardcoded value -99999999
location : 10 digit Aplhanumeric

Expected result should be:
87818813-99999999MICHIGANST

Please advise how to insert this negative signed hardcoded value in between ?

Thanks,
Dinesh
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 08, 2017 7:33 am
Reply with quote

You are confusing in what you post for your output. Is the "numeric with negative sign" supposed to be a zoned decimal field (in which the sign would be overlaid on the last digit and your 87818813 should become 8781881M)? Or is the negative sign supposed to be a separate character? And if it is a separate character, would not inserting -99999999 require the output to be 87818813--99999999MICHIGANST?

And where are you having problems? Inserting a character field of -99999999 is certainly not a hard thing to do with SYNCSORT; you don't need a numeric field since that just complicates the minus sign in front of the value.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Fri Sep 08, 2017 9:34 am
Reply with quote

Thanks for the response!!! Sorry if it confuses...

so in that case if i move '-99999999' to S9(8),please advise how does sign store? is that only works with zoned decimal on this scenario?

If i want to insert character field of -99999999, what is the best option in syncsort i can use it?

Thanks..
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Sep 08, 2017 11:57 am
Reply with quote

1.Account number with negative sign is absurd

2.You seriously need to get better in explaining things

3. In layman terms do you want to hardcode "-99999999" or a value that is equivalent to "-99999999"
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 08, 2017 5:43 pm
Reply with quote

Quote:
so in that case if i move '-99999999' to S9(8),please advise how does sign store? is that only works with zoned decimal on this scenario?
If S9(8) is referring to a COBOL variable PICTURE clause, then unless otherwise modified the value is zoned decimal and the sign would be overlaid on the last byte (X'C?' for positive, X'D?' for negative, and X'F?' for unsigned such as PIC 9(8) instead of S9(8)). COBOL does have a SIGN LEADING SEPARATE and SIGN TRAILING SEPARATE to allow the sign to not be overlaid.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Fri Sep 08, 2017 8:17 pm
Reply with quote

Pandora-Box wrote:
1.Account number with negative sign is absurd .
I haven't mentioned Account number with Negative sign, please read it and reply back. Sorry if it confuses

2.You seriously need to get better in explaining things. If you are not understanding things , please ignore

3. In layman terms do you want to hardcode "-99999999" or a value that is equivalent to "-99999999"
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Sep 08, 2017 8:46 pm
Reply with quote

You simply have to BUILD what you need.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Sat Sep 09, 2017 11:27 am
Reply with quote

Here is the sample code to create an edited field and convert to ZD,

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
87818813MICHIGANST                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN DD *                                           
  OPTION COPY                                         
**
  INREC BUILD=(1,8,C'-99999999',9,10)                 
**CONVERT TO S9(8)                                     
  OUTREC BUILD=(1,8,9,9,SFF,TO=ZD,LENGTH=8,18,10)     
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Sat Sep 09, 2017 11:34 am
Reply with quote

You may first test with INREC BUILD alone

Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
87818813MICHIGANST                         
//SORTOUT  DD SYSOUT=*                     
//SYSIN DD *                               
  OPTION COPY                             
  INREC BUILD=(1,8,C'-99999999',9,10)     


output will be

Code:

87818813-99999999MICHIGANST


Then Try with OUTREC
Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
87818813MICHIGANST                         
//SORTOUT  DD SYSOUT=*                     
//SYSIN DD *                               
  OPTION COPY                             
  INREC BUILD=(1,8,C'-99999999',9,10)     
**CONVERT TO S9(8)                                 
  OUTREC BUILD=(1,8,9,9,SFF,TO=ZD,LENGTH=8,18,10) 


Output will be

Code:

878188139999999RMICHIGANST
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
No new posts XL C Trace Preprocessor Output All Other Mainframe Topics 3
Search our Forums:

Back to Top