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

Convert the COMP and COMP-3 feilds to Numeric fields....


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Wed Jul 08, 2009 10:01 pm
Reply with quote

Hi Everyone...,

I am looking to FTP the a flat file, which contains COMP and COMP-3 feilds, to Oracle team out here...
So i need to Unpacked the COMP & COMP-3 fields so that they can receive the data in pure numeric and character format in the file.

I have search this post but sorry to say i didn't get much as i am pretty new to mainframes....
www.ibmmainframes.com/viewtopic.php?t=41628&highlight=unpacked+data

Please see below the layout of the file:-
01 WS-AP215-REC.
02 WS-AP215-ACCTNO PIC X(08).
02 FILLER PIC X(16).
02 FILLER COMP.
03 FILLER PIC S9(9).
03 FILLER PIC S9(9).
03 FILLER PIC S9.
02 FILLER PIC S999 COMP.
02 HFO-PXADDR-OLD PIC S9999 COMP.
02 HFO-REGION PIC 9.
02 WS-AP215-CUSIP PIC X(9).
02 FILLER PIC X(4).
02 FILLER PIC S9(5)V999 COMP.
02 HFO-NR-ADDS PIC S9.
02 HFO-IND PIC X(3).
02 HFO-DESCR PIC X(24).
02 WS-AP215-SECNO2 PIC X(5).
02 HFO-CSH-SPV PIC S9(13) COMP-3.
02 HFO-CM-REC.
03 HFO-TYPE PIC X.
03 HFO-AUTO PIC X.
03 HFO-MPCT PIC S9V999 COMP.
03 HFO-SDTE PIC S9(9) COMP-3.
03 HFO-1031Q PIC S9(17) COMP.
03 HFO-1031Q-R REDEFINES HFO-1031Q PIC 9(17) COMP.
03 WS-AP215-CSH-1028 PIC S9(17) COMP.
03 HFO-SEGQ PIC S9(9) COMP.
03 FILLER PIC X(29).
03 HFO-1028S PIC S9(11)V99 COMP-3.
02 HFWA-CSH-OFCOSHP PIC XXX.
02 F PIC X(15).

Can you please let me how to convert the file ?

Can i get the field value with sign and decimal like eg:-
For S9(4)v9(3) COMP or S9(4)v9(3) COMP-3 ==> Fields comes out to be like ==> -2345.678 ==> that is with sign and decimal point.

I hope you understand what i am looking for.

Thanks in advance,
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: Wed Jul 08, 2009 11:20 pm
Reply with quote

See the following:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/C.3?DT=20080528171007

As shown, COMP is equivalent to BI (unsigned) or FI (signed) and COMP-3 is equivalent to PD.

You can edit these fields with appropriate DFSORT edit masks, e.g.

p,m,PD,EDIT=(STTTT.TTT),SIGNS=(+,-)

where p is the starting position (e.g. 11), m is the length (e.g. 4) and PD is the format (or BI or FI as appropriate).

For more information, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG30/2.4.8?DT=20080529102039
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Thu Jul 09, 2009 12:52 am
Reply with quote

I understood for sort statements on comp,comp-3, 999, XX kind of data types... But for can you tell me about S9 ?

Please confirm me....
what kind of the sort statement for
02 HFO-NR-ADDS PIC S9.


Copybook:-

01 WS-AP215-REC.
02 WS-AP215-ACCTNO PIC X(08).
02 FILLER PIC X(16).
02 FILLER COMP.
03 FILLER PIC S9(9).
03 FILLER PIC S9(9).
03 FILLER PIC S9.
02 FILLER PIC S999 COMP.
02 HFO-PXADDR-OLD PIC S9999 COMP.
02 HFO-REGION PIC 9.
02 WS-AP215-CUSIP PIC X(9).
02 FILLER PIC X(4).
02 FILLER PIC S9(5)V999 COMP.
02 HFO-NR-ADDS PIC S9.
02 HFO-IND PIC X(3).
02 HFO-DESCR PIC X(24).
02 WS-AP215-SECNO2 PIC X(5).
02 HFO-CSH-SPV PIC S9(13) COMP-3.
02 HFO-CM-REC.
03 HFO-TYPE PIC X.
03 HFO-AUTO PIC X.
03 HFO-MPCT PIC S9V999 COMP.
03 HFO-SDTE PIC S9(9) COMP-3.
03 HFO-1031Q PIC S9(17) COMP.
03 HFO-1031Q-R REDEFINES HFO-1031Q PIC 9(17) COMP.
03 WS-AP215-CSH-1028 PIC S9(17) COMP.
03 HFO-SEGQ PIC S9(9) COMP.
03 FILLER PIC X(29).
03 HFO-1028S PIC S9(11)V99 COMP-3.
02 HFWA-CSH-OFCOSHP PIC XXX.
02 F PIC X(15).
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: Thu Jul 09, 2009 12:57 am
Reply with quote

S9 is equivalent to a 1-byte ZD field so you could use something like:

Code:

p,1,ZD,EDIT=(ST),SIGNS=(+,-)
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Thu Jul 09, 2009 3:55 am
Reply with quote

Thanks Frank....
Appreciate your help...

Just one more thing i wanna ask... If we wanna show a exact value which is stored in the COMP-3 or COMP value. then what would be the data type of output fields used ?

for ex.:-
One field of input file has - S9(15)V9(2) COMP-3 = -012345678912345.22
Second field of input file has- S9(10)V9(4) COMP = -0123456789.2233

Now i want to move the value in out put file so that when i open the output file it will show me the exact value of every comp-3/comp feilds i.e. For first field <-012345678912345.22> and <-0123456789.22
33>for second field.

I hope you understand.
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: Thu Jul 09, 2009 4:10 am
Reply with quote

Well, I understand but there's really no built-in functions to do that.

DFSORT has no knowledge of those declarations or any ability to translate them into output edit masks automatically. You could use the REXX program from the "Create DFSORT Symbols from COBOL Copybook" Smart DFSORT Trick at:

www.ibm.com/support/docview.wss?rs=0&uid=isg3T7000094

to create DFSORT Symbols, but the resulting symbols will only get you the DFSORT input formats (ZD, PD, etc). You are talking about "output formats" which DFSORT does with edit masks. I don't know of any tool to generate the correct edit masks from the COBOL copybook. You would have to specify the correct edit masks yourself based on the original COBOL declaration.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top