View previous topic :: View next topic
|
Author |
Message |
scdinesh
New User
Joined: 06 Sep 2006 Posts: 44 Location: United States
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
scdinesh
New User
Joined: 06 Sep 2006 Posts: 44 Location: United States
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
scdinesh
New User
Joined: 06 Sep 2006 Posts: 44 Location: United States
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3049 Location: NYC,USA
|
|
|
|
You simply have to BUILD what you need. |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
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 |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
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 |
|
|
|