View previous topic :: View next topic
|
Author |
Message |
Phoenix
New User
Joined: 27 Feb 2007 Posts: 20 Location: Chennai
|
|
|
|
I have an input file in which a field is in coming to be in Hexadecimal format ( The value is a result of subtraction of two PD fields and are all negative because of which it is coming in hex form ).
Any suggestions regarding how do I convert it the same in SYNCSORT?
Cheers,
Phoenix. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Quote: |
I need it to be displayed as a signed numeric. My shop is using Syncsort and the (...HEX,TO=ZD,....) syntax of DFSORT is not working.
|
Show the SORT card what you tried?
Show what error u received? |
|
Back to top |
|
|
Phoenix
New User
Joined: 27 Feb 2007 Posts: 20 Location: Chennai
|
|
|
|
Hi,
Below is the control card:
Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C' '),
OVERLAY=(1:1,75,
76:76,9,HEX,TO=ZD,LENGTH=9,
85:85,49)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,133))
END |
And here is the error message:
Code: |
SYSIN :
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C' '),
OVERLAY=(1:1,75,
76:76,9,HEX,TO=ZD,LENGTH=9,
*
85:85,49)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,133))
END
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
|
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
There is a CONVERT key word. Check the SYNCSORT manuals you should have available to you at your site. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Reaplace HEX with PD
stodolas wrote: |
There is a CONVERT key word. Check the SYNCSORT manuals you should have available to you at your site. |
CONVERT is for FB to VB conversion. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
I just ran a search through the manual and REPLACE is not a keyword for SYNCSORT. But you are correct on the convert function. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
stodolas wrote: |
I just ran a search through the manual and REPLACE is not a keyword for SYNCSORT. But you are correct on the convert function. |
I didnt mean to say use the Keyword "Replace", i told to replace the word HEX to PD
That is Phoenix's SORT card should be changed to
Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C' '),
OVERLAY=(1:1,75,
76:76,9,PD,TO=ZD,LENGTH=9,
85:85,49)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,133)) |
|
|
Back to top |
|
|
Phoenix
New User
Joined: 27 Feb 2007 Posts: 20 Location: Chennai
|
|
|
|
Hello,
I think i didn't explain the problem properly, so here is an example:
My output file is having a field which is having values written as below:
Code: |
00000000M
00000000M
00000000Q
00000000Q
00000000J
00000000J
00000000K
|
these are the HEX values of the numbers -4-,4,-8,-8,-1,-1 and -2
whereas I want it to be as with as many/no preceeding zeros ( the output field is anyway 9 bytes):
Code: |
-0004
-0004
-0008
-0008
-0001
-0001
-0002
|
I already tried what you mean by changing HEX to PD but that didn't help as the field has value in hexadecimal. With PD I get the output as below:
Code: |
.0.0.0.0.M
.0.0.0.0.M
.0.0.0.0.Q
.0.0.0.0.Q
.0.0.0.0.J
.0.0.0.0.J
.0.0.0.0.K
|
Please advice if there exists a solutiion to convert hexadecimal numbers to negative numbers with sign.
Cheers,
Phoenix. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Phoenix wrote: |
Hello,
I think i didn't explain the problem properly, so here is an example:
My output file is having a field which is having values written as below:
Code: |
00000000M
00000000M
00000000Q
00000000Q
00000000J
00000000J
00000000K
|
|
Those are signed packed decimal numbers. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Correction on that I should have said SIGNED ZONED DECIMAL. |
|
Back to top |
|
|
Phoenix
New User
Joined: 27 Feb 2007 Posts: 20 Location: Chennai
|
|
|
|
Hi Craq,
Here in the output file they were written as characters via a QUIKJOB in which I have two PD numbers say A and B ( both S9(9) comp-3) .
Now there are two fields in the report say QTY-1 and QTY-2 (both also S9(9) comp-3) that come from addition and subtraction of these numbers.
So
QTY-1 = A + B which will always be positive as both A and B are always positive, and
QTY-2 = A - B which may be negative depending on the values of A and B, and in all the cases for my requirement B > A so QTY-2 is always -ve.
Now when QTY-1 and QTY-2 are being moved to character fields X(9) in the output, QTY-1 which is positive is displaying correctly as say for e.g. = 000000045,
but QTY-2 being negative is being displayed in hex format.
So yes these are PD numbers being moved to equivalent character fields in the output file.
Code: |
00000000M
00000000M
00000000Q
00000000Q
00000000J
00000000J
00000000K
|
I hope i am clear.
Cheers,
Phoenix |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Your i/p sis not hexadecimal its Zone Decimal fomat(ZD)
Code: |
//***************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00000000M
00000000M
00000000Q
00000000Q
00000000J
00000000J
00000000K
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,9,ZD,EDIT=(STTTT),SIGNS=(+,-),80:X)
SORT FIELDS=COPY
/* |
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If you ask for the right thing it is much easier to get the correct answer. |
|
Back to top |
|
|
Phoenix
New User
Joined: 27 Feb 2007 Posts: 20 Location: Chennai
|
|
|
|
Thanks Kris. It worked this time.
thanks a lot.
Cheers,
Phoenix. |
|
Back to top |
|
|
|