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

Convert COMP-1 to Readable


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

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Aug 14, 2012 5:33 pm
Reply with quote

Hi,

Is there a way to convert COMP-1 data type to readable format?

Like COMP-1 --> 1.2222E01
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Tue Aug 14, 2012 5:35 pm
Reply with quote

yes
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Aug 14, 2012 5:36 pm
Reply with quote

I presume you mean with SYNCSORT as JCL cannot do it and SYNCSORT questions come under this part of the forum.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 14, 2012 5:44 pm
Reply with quote

gylbharat wrote:
Is there a way to convert COMP-1 data type to readable format?

Like COMP-1 --> 1.2222E01
Do you want to use COBOL or some sort product at your shop. File-Aid can also do it, however, can't really give a direct syntax - as this shop does not have File-Aid installed but it might worth a shot, if you've it and you intend to use it.

Or REXX: ibmmainframes.com/about53643.html
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Aug 14, 2012 5:47 pm
Reply with quote

I want to do it through Syncsort.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Tue Aug 14, 2012 5:50 pm
Reply with quote

thanks &deity, couldn' t You have said so from the beginning icon_cool.gif
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Aug 14, 2012 6:18 pm
Reply with quote

FWIW, this can be done easily in Assembler, COBOL and PL/I.

In fact, the same code can be used for COMP (Halfword/Fullword) and COMP-2 (Long Float).

Review the following - it's the same concept for all of the above data-formats, including COMP-1 -

www.ibmmainframes.com/viewtopic.php?p=172218&highlight=#172218
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 14, 2012 6:34 pm
Reply with quote

gylbharat- I wonder, you dont' remember this one: ibmmainframes.com/about55471.html
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 16, 2012 12:10 pm
Reply with quote

Hi,

I know, i raised this request some time back... but now its not FTP... we are doing a migration from VSAM files to DB2... we want to get the data in the readable format and then load data in DB2 through load utilities...

We want data to be in readable as it would also help in reconciliation.

Please let me know how we can convert COMP-1 and COMP-2 to readable format through SORT.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 16, 2012 1:11 pm
Reply with quote

db2 has floating point (real and double - which is your comp-1 and comp-2 cobol types).

are you going to have db2 real and double or decimal datatypes?

my own question, but how are you going to reconcile?

maybe using the edit masks to convert floating point to 'readable'.
FL Floating point. Normalized. Signed.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 16, 2012 1:37 pm
Reply with quote

Most probably we would be loading these values in Decimal data types..

Dick, Can you give me a sample to convert FL using EDIT MASKS to readable format?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 16, 2012 1:53 pm
Reply with quote

sorry, i am not a syncsort user, i only have a manual.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 16, 2012 3:43 pm
Reply with quote

Thanks Dick.... I will refer the manual... but a small sample would be helpful... may be someone who is syncsort expert can provide a sample icon_smile.gif
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: Thu Aug 16, 2012 7:19 pm
Reply with quote

Hello,

Syncsort MFX (1.4) supports Floating Point.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 23, 2012 4:01 pm
Reply with quote

Any idea any one.... how do we convert comp-1 or comp-2 to readable format using sort?
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: Thu Aug 23, 2012 7:16 pm
Reply with quote

Hello,

If i understand, currently the floating point data is processed by the application. DB2 supports floating point (and the table(s) would surely store the data as floating point).

Why is there a need to create something "readable" in the middle? How does the application currently present these values so people can read them?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 23, 2012 8:22 pm
Reply with quote

You're the one with Syncsort. Did you try with an edit mask? I agree with Dick and dbz, why bother making it "readable" (to humans with no knowledge of internal data representations). It sounds like DB2'll su** it up just fine as it is.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Aug 24, 2012 5:17 pm
Reply with quote

Hi,

Currently the floating point data is present in the VSAM file...

We will be writing a SORT to convert the VSAM file data to flat file with all readable data. That is expanding comp, comp-3, etc... Only problem is with the COMP-1 and COMP-2 fields where we are not able to convert it into readable format using sort.

Once we have the data in the readable format , we will FTP this data to Unix server, where it will be loaded in oracle table.

Having data in the readable format makes it easier in analysis and verify data.

Please let me know how we can convert the COMP-1 data to readable format?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2012 6:08 pm
Reply with quote

OK, that is a very good reason to have it in character/text.

Have you tried the edit mask? Seems I've asked that before.
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: Fri Aug 24, 2012 7:15 pm
Reply with quote

Hello,

How does the current application present these fields to the user?

You may neeed to do the same thing here to get what you want. Possibly by coding a SORT Exit.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Aug 27, 2012 1:29 pm
Reply with quote

Hi,

I tried running with EDIT masks... But every data can be different depending upon power of 10. In such cases how do we specify how many digits there will be after decimal point.

Example.

INPUT FILE:
Code:

  RECFM FB  LRECL 80  Rec# 1 - CAPS OFF  I+D ON                         
       EMP-ID      FILLER      EMP-NAME      FILLER        EMP-FD       
       C(6) (1-6)  C(1) (7-7)  C(10) (8-17)  C(1) (18-18)  FP(4) (19-22)
       ----------  ----------  ------------  ------------  -------------
****** ************************** TOP OF DATA **************************
000001 111111                  AAAAAAA                     +1.23456E+01
000002 111111                  AAAAAAA                     +1.23456E+02
000003 111111                  AAAAAAA                     +1.23456E+03
000004 111111                  AAAAAAA                     +1.23456E+04
000005 111111                  AAAAAAA                     +1.23456E+05
000006 111111                  AAAAAAA                     +1.23456E+06
000007 111111                  AAAAAAA                     +1.23456E+07
000008 111111                  AAAAAAA                     +1.23456E+08
000009 111111                  AAAAAAA                     +1.23456E+09
000010 111111                  AAAAAAA                     +1.23456E+10
000011 111111                  AAAAAAA                     +1.23456E+11
000012 111111                  AAAAAAA                     +1.23456E-01
000013 111111                  AAAAAAA                     +1.23456E-02
000014 111111                  AAAAAAA                     +1.23456E-03
000015 111111                  AAAAAAA                     +1.23456E-04
000016 111111                  AAAAAAA                     +1.23456E-05
000017 111111                  AAAAAAA                     +1.23456E-06
000018 111111                  AAAAAAA                     +1.23456E-07
000019 111111                  AAAAAAA                     +1.23456E-08
000020 111111                  AAAAAAA                     +1.23456E-09
000021 111111                  AAAAAAA                     +1.23456E-10
000022 111111                  AAAAAAA                     +1.23456E-11


SORT JOB
Code:

//STEP EXEC PGM=SORT                                                 
//SORTIN DD DSN=DATASET,DISP=SHR                                     
//SORTOUT DD SYSOUT=*                                               
//SYSOUT  DD SYSOUT=*                                               
//SYSIN   DD *                                                       
  SORT FIELDS=COPY                                                   
  OUTREC FIELDS=(1,22,C'*',19,4,FL,EDIT=(TTTTTTTTTT.TTTTTTTTTTTTT)) 


SORTOUT OUTPUT
Code:

****** ***************************** Top of Data ******************************
000001 111111 AAAAAAA     Egº*0000000000.0000000000012                         
000002 111111 AAAAAAA    â#ÈA*0000000000.0000000000123                         
000003 111111 AAAAAAA    ä( 8*0000000000.0000000001234                         
000004 111111 AAAAAAA    à  º*0000000000.0000000012345                         
000005 111111 AAAAAAA    á   *0000000000.0000000123456                         
000006 111111 AAAAAAA    ã Oa*0000000000.0000001234561                         
000007 111111 AAAAAAA    ã¯/ *0000000000.0000012345614                         
000008 111111 AAAAAAA    åͯy*0000000000.0000123456128                         
000009 111111 AAAAAAA    çñnY*0000000000.0001234561024                         
000010 111111 AAAAAAA    ñ Ù£*0000000000.0012345610240                         
000011 111111 AAAAAAA    ¢ ´þ*0000000000.0123456061440                         
000012 111111 AAAAAAA      ªJ*0000000000.0000000000000                         
000013 111111 AAAAAAA      j+*0000000000.0000000000000                         
000014 111111 AAAAAAA     &Y=*0000000000.0000000000000                         
000015 111111 AAAAAAA     aËÚ*0000000000.0000000000000                         
000016 111111 AAAAAAA     õ Ú*0000000000.0000000000000                         
000017 111111 AAAAAAA      ¶Ã*0000000000.0000000000000                         
000018 111111 AAAAAAA       Q*0000000000.0000000000000                         
000019 111111 AAAAAAA        *0000000000.0000000000000                         
000020 111111 AAAAAAA     èOy*0000000000.0000000000000                         
000021 111111 AAAAAAA     g¨û*0000000000.0000000000000                         
000022 111111 AAAAAAA     R D*0000000000.0000000000000                         
****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 27, 2012 1:37 pm
Reply with quote

Easy. There will always be one digit in front of the decimal place. By convention, this will either be significati (1 through 9) or zero. The rest of (or the entire) the number is represented in the decimal part, and carries a "scaling" factor, like your example. E+09, E-02. Which is X10 to the power of 9, and X10 to the power of minus 2 (the last is a number less than 1 or greater than -1 if the number is negative.

If there is nothing in the MASK which supports this notation, then you can't do it with the MASK.

Which leaves, doing it in a program, or trying to "unpick" the data format. If you want to try the last, you have to find out how COMP-1 is stored (COMP-2 is the same, just longer).
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Aug 27, 2012 2:38 pm
Reply with quote

Is there a way in sort to convert FL to External floating point as 1.23E+01
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 27, 2012 2:52 pm
Reply with quote

This is taking a long time :-)

You have Syncsort documentation. You can check whether there is anything in the edit MASK which supports floating point.

If there is not, you either have to "invent" a method to do it by decomposing the format of the data that the "float" is held in, or your need to do it in something else (as was suggested much earlier in the thread).
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Aug 27, 2012 3:31 pm
Reply with quote

I do not have syncsort documentation... However, I checked the edit masks given in the below link...

www.ibmmainframes.com/post-40358.html

looks like there is no edit mask for floating point numbers.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts String has hex character need to conv... COBOL Programming 3
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts JCL to read ps and convert it to read... DFSORT/ICETOOL 1
No new posts VSAM - Convert Hex to decimal JCL & VSAM 7
Search our Forums:

Back to Top