Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Hardcoded negative sign value in output

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
scdinesh
Warnings : 1

New User


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

PostPosted: Fri Sep 08, 2017 5:28 am    Post subject: Hardcoded negative sign value in output
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: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Fri Sep 08, 2017 7:33 am    Post subject: Reply to: Hardcoded negative sign value in output
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
Warnings : 1

New User


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

PostPosted: Fri Sep 08, 2017 9:34 am    Post subject:
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

Moderator


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

PostPosted: Fri Sep 08, 2017 11:57 am    Post subject:
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: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Fri Sep 08, 2017 5:43 pm    Post subject:
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
Warnings : 1

New User


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

PostPosted: Fri Sep 08, 2017 8:17 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1788
Location: NY,USA

PostPosted: Fri Sep 08, 2017 8:46 pm    Post subject:
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: 202
Location: Chennai

PostPosted: Sat Sep 09, 2017 11:27 am    Post subject: Reply to: Hardcoded negative sign value in output
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: 202
Location: Chennai

PostPosted: Sat Sep 09, 2017 11:34 am    Post subject: Reply to: Hardcoded negative sign value in output
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us