got wrong data while converting Binary data Zoned decimal

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER
thotlma
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Skillset: jcl,vsam,cobol,db2,rexx
Referer: google

got wrong data while converting Binary data Zoned decimal

Postby thotlma » Thu Sep 26, 2019 8:58 pm

HI Every one

As part one my requirmement i need convert the binary data to zoned decimal
i have used below code but i am geeting wrong data in the out put file
could you please help me to sort out issue would be great.

Code: Select all


SORT FIELDS=COPY                      
OUTREC FIELDS=(1,6,BI,TO=ZD,LENGTH=14)

Input file

Code: Select all

----+--
.gÇm.!
.g¦..!
.g%..!
.g2ÿ..
.g2ÿ..
.g2ÿ..


Out put file

Command ===>

Code: Select all

----+----1----
****** **************
000001 00000000000000
000002 00000000000000
000003 00000000000000
000004 00000000000000
000005 00000000000035
000006 00000000000106
000007 00000000000132

enrico-sorichetti
Global moderator
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
Referer: www.ibmmainframes.com

Re: got wrong data while converting Binary data Zoned decima

Postby enrico-sorichetti » Thu Sep 26, 2019 9:25 pm

You should have posted the hex representation of Your data

ispf HEX ON is Your friend
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

Re: got wrong data while converting Binary data Zoned decima

Postby NicC » Fri Sep 27, 2019 1:24 am

Why post in the Forum Rules?
Topic moved.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

thotlma
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Skillset: jcl,vsam,cobol,db2,rexx
Referer: google

Re: got wrong data while converting Binary data Zoned decima

Postby thotlma » Fri Sep 27, 2019 4:58 pm

enrico-sorichetti wrote:You should have posted the hex representation of Your data

ispf HEX ON is Your friend

input

Code: Select all

=COLS> ----+----1----+----2
 004457  qo"                
        09970144444444444444
        086F0400000000000000
 ----------------------------
 004458  qo"
               
        09970144444444444444
        086F0F00000000000000
 ----------------------------
 004459  qo"                
        09970344444444444444
        086F0300000000000000
 ----------------------------
 004460  qo"
               
        09970344444444444444
        086F0D00000000000000




output

Code: Select all


=COLS> ----+----1----+----2
004457 00000009999999      
       FFFFFFFFFFFFFF000000
       00000009999999000000
----------------------------
004458 00000009999999      
       FFFFFFFFFFFFFF000000
       00000009999999000000
----------------------------
004459 00000009999999      
       FFFFFFFFFFFFFF000000
       00000009999999000000
----------------------------
004460 00000009999999      
       FFFFFFFFFFFFFF000000
       00000009999999000000

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

Re: got wrong data while converting Binary data Zoned decima

Postby NicC » Fri Sep 27, 2019 5:26 pm

That input looks like 2 packed decimal fields not one binary field.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

thotlma
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Skillset: jcl,vsam,cobol,db2,rexx
Referer: google

Re: got wrong data while converting Binary data Zoned decima

Postby thotlma » Fri Sep 27, 2019 6:09 pm

my requirement to convert input data to numeric data.
the values getting into input as defined comp vaues in cobol prog.
even i tried PD to ZD also please below out put

Code: Select all


 =COLS> ----+----1----
 004457 0000098967 001
 004458 0000098967 001
 004459 0000098967 00L
 004460 0000098967 00L

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: got wrong data while converting Binary data Zoned decima

Postby sergeyken » Fri Sep 27, 2019 11:36 pm

thotlma wrote:input

Code: Select all

=COLS> ----+----1----+----2
 004457  qo"                
        09970144444444444444
        086F0400000000000000
 ----------------------------
 004458  qo"
               
        09970144444444444444
        086F0F00000000000000
 ----------------------------
 004459  qo"                
        09970344444444444444
        086F0300000000000000
 ----------------------------
 004460  qo"
               
        09970344444444444444
        086F0D00000000000000


1) Your input data do not look like binary (e.g. COMP in COBOL, or BI/FI in SORT).
Rather they do look like packed decimal (e.g. COMP-3 in COBOL, or PD in SORT).

2) From your "files display" it is absolutely not clear how your "files" are related, at all, to your SORT statements example???
Please, present FULL example of your test (simplified as much as possible) to find out the actual processing issues.
Javas and Pythons come and go, but JCL and SORT stay forever.

thotlma
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Skillset: jcl,vsam,cobol,db2,rexx
Referer: google

Re: got wrong data while converting Binary data Zoned decima

Postby thotlma » Mon Sep 30, 2019 8:02 pm

The acutual input genarating from Cobol Prog and the fields defined in cobol prog as below
XXXXX PIC S9(9) USAGE COMP
XXXXX PIC S9(4) USAGE COMP
i need to convert the above data to numeric format for other process.
i thought it was binary so i wrote a sort to convert ZD but didnot work
could you please help for this one?

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

Re: got wrong data while converting Binary data Zoned decima

Postby Robert Sample » Mon Sep 30, 2019 8:45 pm

Since it is two separate fields, you have to handle each individually in SORT:

Code: Select all

SORT FIELDS=COPY                      
OUTREC FIELDS=(1,4,BI,TO=ZD,LENGTH=9,5,2,BI,TO=ZD,LENGTH=5)
Also, if the data set is variable length instead of fixed length, you need to add 4 to each of your locations because of the RDW.

thotlma
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Skillset: jcl,vsam,cobol,db2,rexx
Referer: google

Re: got wrong data while converting Binary data Zoned decima

Postby thotlma » Mon Sep 30, 2019 10:45 pm

Its working ...Thanks a lot Robert
the data set is fixed length only.
i have some doubts about sort card .why did take length 9 and 5?
never mind if you explain clearly that would be great..


  • Similar Topics
    Replies
    Views
    Last post