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

Binary and Comp-3 >>> Human readable format


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

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Fri Apr 30, 2010 12:46 am
Reply with quote

Hi All,

I need some help in converting binary and pack decimal fields to convert in human readable format.

In my input file the record length = 1200 and some of the fields are char ,binary and comp-3, now users are asking to replicate the input file and they want to see the data in such a way that when they open the file it should be in readable format.

Now for the alphanumeric fields there is no problem because one can see them without any problem but what should I use to convert binary and comp-3 fields.

I tried OUTFIL OUTREC=(1,2,BI,TO=ZD,LENGTH=5) >>>>just for example …..

But its not working .. .

Could you please advise on this ?

Thanks
Harrry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 30, 2010 1:39 am
Reply with quote

Quote:
But its not working .. .


This provides no useful information.

1,2,BI,TO=ZD,LENGTH=5 will convert a 2-byte unsigned binary field to a 5 byte ZD field.

1,2,FI,TO=ZD,LENGTH=5 will convert a 2-byte signed fixed field to a 5 byte ZD field.

1,2,FI,EDIT=(STTTTT),SIGNS=(+,-) is another way of doing the conversion if you want a value like +12345 or -1235.

There are many, many, many variations for BI, FI and PD.

How you would use DFSORT to do what you want to do depends on what you want to do which you haven't told us. What do the input fields look like in hex? What do you want the output fields to look like?
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Fri Apr 30, 2010 5:49 pm
Reply with quote

I am sorry If my requirements are not clear , this is what I want :

There are three fields :
1> Field-1 --- PIC S9(010) COMP-3.

2> Field-2 --- PIC S9(004) USAGE COMP.

3> Field-3---- PIC S9(005)V9(06) COMP-3.


Data in the input file :

Field-1

00000
0006C

Field-2

00
01

Field-3

001000
00000C

I want the output file to represent this input file in the human readable format , means if some one browse the data in mainframe file he should be in the position to understand the data without giving the hex on ….because for comp-3 and binary generally we give hex on and then read the data.

Required output :

Field-1:

This is 60 –

Field-2
same as above

Field-3
Same as above .

now can some one help me on this ?
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Fri Apr 30, 2010 6:20 pm
Reply with quote

Nothing is impossible in this world , and I am 100 % sure DFSORT can easily do it .

See this is how I am heading to do it :


SORT FIELDS=COPY
OUTREC FIELDS=(1,160,161,5,PD,TO=ZD,LENGTH=05)

I am getting the value but its getting one extra { which is now I am struggling with ,

Input
00000
0006C

Output using above sort card
0006{

I am just waiting for some expert to look into my post , and they will give me their valuable advise.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Apr 30, 2010 6:23 pm
Reply with quote

harry wrote:
Output using above sort card
0006{

I am just waiting for some expert to look into my post , and they will give me their valuable advise.
Try to read the entire replys to your questions.....
Quote:
1,2,FI,EDIT=(STTTTT),SIGNS=(+,-) is another way of doing the conversion if you want a value like +12345 or -1235.
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Fri Apr 30, 2010 6:38 pm
Reply with quote

Its giving the wrong results for the comp-3 fileds if i use

(1,2,FI,EDIT=(STTTTT),SIGNS=(+,-) )

My input file

00000
0006C

Output :

+01548- after using (1,2,FI,EDIT=(STTTTT),SIGNS=(+,-) )

or only 1,2,FI,TO=ZD,LENGTH=5

It should be 60 not +01548.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 30, 2010 7:07 pm
Reply with quote

Quote:
+01548


why not use a bit of imagination...
somewhere You have defined the input field as a binary field, not a packed one

060c ( binary ) = 1548 ( decimal )

BI unsigned binary
FI signed binary

as suggested by Frank
Quote:
There are many, many, many variations for BI, FI and PD.
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Fri Apr 30, 2010 7:19 pm
Reply with quote

If you look at my original request I have mentioned both BI and Pack-decimal.

Now would you tell me that when i am using

Input00000
0006C

Sort Card

161,5,PD,TO=ZD,LENGTH=5

Output

0006{
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 30, 2010 7:34 pm
Reply with quote

I do not care about Your original request ...
You complained that you got the wrong result and I gave You the reason why !

comp-3 is a packed decimal, and You used a binary <thing>

Quote:
Input
00000
0006C

Output using above sort card
0006{


ZD is a zoned decimal with sign
which is an almost char representation with the exception of the last byte
which holds in the zone part the sign

F/C for a positive number
D for a negative one

see ibmmainframes.com/viewtopic.php?t=40254&highlight=zoned+decimal
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 30, 2010 10:38 pm
Reply with quote

Quote:
Output using above sort card
0006{


You posted in the DFSORT Forum, so I assumed you were actually using DFSORT. But if you were using DFSORT, you'd get 00060 not 0006{.
So you must be using Syncsort, not DFSORT.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

Please post Syncsort questions in the JCL Forum.
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Sat May 01, 2010 5:49 am
Reply with quote

Please help me . Yes I am using the SYNCSORT.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat May 01, 2010 6:24 am
Reply with quote

Dang it, you have been fed the information you are requesting, it's all there, why don't you look at the manual and put two and two together?

This topic should be locked and you should be warned that your lack of desire to help yourself should be a wakeup call for your selfish demands.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 01, 2010 7:49 am
Reply with quote

Hello,

Suggest you read back through the topic and understand what different people have told you.

Something to consider as you do this is that your process is working completely correctly (at least from what i can see). You may want the output to appear slightly differently, but what has been created would work if read into another program. . .

You could also benefit from looking in the forum for the different values that will result when creating signed zoned-decimal output.

If you find something that is not clear, post what you found and your doubt and someone should be able to clarify.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 01, 2010 6:58 pm
Reply with quote

While you're reading back, keep this in mind:

You said -
Quote:
There are three fields :
1> Field-1 --- PIC S9(010) COMP-3.

Quote:
Data in the input file :

Field-1

00000
0006C

Field 1 really contains 6 bytes:
Code:
000000
00006C
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top