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

To covert a Hexadecimal field to a displayable Zoned format.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Phoenix

New User


Joined: 27 Feb 2007
Posts: 20
Location: Chennai

PostPosted: Fri Feb 01, 2008 1:16 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 1:43 pm
Reply with quote

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
View user's profile Send private message
Phoenix

New User


Joined: 27 Feb 2007
Posts: 20
Location: Chennai

PostPosted: Fri Feb 01, 2008 1:50 pm
Reply with quote

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
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 631
Location: Wisconsin

PostPosted: Fri Feb 01, 2008 6:17 pm
Reply with quote

There is a CONVERT key word. Check the SYNCSORT manuals you should have available to you at your site.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 7:51 pm
Reply with quote

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
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 631
Location: Wisconsin

PostPosted: Fri Feb 01, 2008 8:00 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 8:12 pm
Reply with quote

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
View user's profile Send private message
Phoenix

New User


Joined: 27 Feb 2007
Posts: 20
Location: Chennai

PostPosted: Mon Feb 04, 2008 2:31 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Feb 04, 2008 4:49 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Feb 04, 2008 6:07 pm
Reply with quote

Correction on that I should have said SIGNED ZONED DECIMAL.
Back to top
View user's profile Send private message
Phoenix

New User


Joined: 27 Feb 2007
Posts: 20
Location: Chennai

PostPosted: Tue Feb 05, 2008 1:19 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Feb 05, 2008 3:16 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Feb 05, 2008 3:50 pm
Reply with quote

If you ask for the right thing it is much easier to get the correct answer.
Back to top
View user's profile Send private message
Phoenix

New User


Joined: 27 Feb 2007
Posts: 20
Location: Chennai

PostPosted: Tue Feb 05, 2008 3:54 pm
Reply with quote

Thanks Kris. It worked this time.

thanks a lot.

Cheers,
Phoenix.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 9
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts small int to zoned decimal conversion DFSORT/ICETOOL 3
No new posts Format Binary file to EBCDIC JCL & VSAM 4
Search our Forums:

Back to Top