Can SyncSort convert data types.



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Can SyncSort convert data types.

Postby chillmo » Wed Aug 30, 2017 9:05 pm

Hello world!!! I'm new to SyncSort; however, please see my question below.

My input rec is FB 740 and has COMP data (see sample file layout below). I would like to convert these fields to a COMP-3 data type.

         05  GBB-APP-CODE                    PIC 9(01)       COMP.
         05  GZZ-INST-NBR                    PIC 9(03)       COMP.
         05  GCC-ACCT-NBR                    PIC 9(10)       COMP.
         05  GDD-CK-DIG                      PIC 9(01)       COMP.
         05  FILLER                          PIC 9(02)       COMP.
         05  GEE-DDA-LINK-ADDR               PIC 9(07)       COMP.
         05  GRR-AG-NEG-COL-BL               PIC 9(10)       COMP.
         05  GTT-AGG-NEG-DAYS                PIC 9(03)       COMP.
         05  FILLER                          PIC 9(10)       COMP.
         05  GTT-AGG-POS-DAYS                PIC 9(03)       COMP.
         05  GQQ-CASH-DEP-CT                 PIC 9(04)       COMP.
         05  GSS-CHK-DRAWN-UCF               PIC 9(04)       COMP.
         05  GZZ-COLL-ITEM-DOM               PIC 9(04)       COMP.
         05  GXX-COLL-ITEM-FOR               PIC 9(04)       COMP.
 

How would I accomplish this w/SyncSort?

Coded
chillmo
 
Posts: 11
Joined: Wed Aug 30, 2017 8:56 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Can SyncSort convert data types.

Postby Robert Sample » Thu Aug 31, 2017 12:38 am

How would I accomplish this w/SyncSort?
Convert field type BI to field type PD. Be careful of the changes in field lengths that such a conversion requires since your record length almost certainly will not be the same.

If you are asking for code to do this, are you prepared to pay the going rate (from 500 to 2000 US dollars per day)? If you are not prepared to pay for code, then don't ask for it -- this is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Can SyncSort convert data types.

Postby chillmo » Thu Aug 31, 2017 2:09 am

Mr. Sample thank for the reply but I have the code ......it didn't work (see below).

SORT FIELDS=(1,1,BI,A)
OUTREC FIELDS=(1,1,BI,TO=PD,LENGTH=1,X,
3,2,BI,TO=PD,LENGTH=3,X,
4,8,BI,TO=PD,LENGTH=5)
OPTION HIPRMAX=OPTIMAL

I'm fully aware my output file length will change but I set the length, per my layout...is this right? I'm NOT sure what the start and end position would be on a COMP field (I'm very familiar with COMP-3).

This is how the input file looks...
2709005
0249965

APP-CODE equals 2
INST-NBR should be 072
ACCT-NBR should 0499090655

My results do NOT equal this....help!!!
chillmo
 
Posts: 11
Joined: Wed Aug 30, 2017 8:56 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Can SyncSort convert data types.

Postby Robert Sample » Thu Aug 31, 2017 2:25 am

I think you have a confusion about lengths, and possibly one about how to read the data. COMP fields in COBOL will be 2, 4, or 8 bytes long -- period. A PIC 9(1) COMP variable takes 2 bytes so your value for GBB-APP-CODE will be X'2072' not X'20' -- and DEFINITELY not X'02' since the byte values are X'20' and X'72' (read the value DOWN, not UP). GZZ-INST-NBR will be X'0499' (the next 2 bytes of the record). And recall that COMP stores the BINARY, not decimal, value so even if you had X'20' for a byte, that would equate to 32 in decimal (2 times 16 plus 0 times 1). The X'0499' is decimal 1177.

COBOL determines the length of a COMP field as:
PIC 9(1) through PIC 9(4) -- 2 bytes
PIC 9(5) through PIC 9(9) -- 4 bytes
PIC 9(10) through PIC 9(18) -- 8 bytes

Depending upon your compiler options, the "actual" value may be reduced to the PICTURE size (so even though 32767 can be stored in 2 bytes, COBOL may allow a maximum of 9999 for the value). COMP-5 variables always allow the maximum value (COBOL will not truncate to the PICTURE size), and are usually preferred over COMP since a compiler option change will affect your results with COMP.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Can SyncSort convert data types.

Postby chillmo » Thu Aug 31, 2017 6:49 am

Thanks Mr. Sample for the education.

However, I need to display the actual value, NOT BINARY, value of the data....it doesn't appear my SyncSort will do this. I need to provide this data to non-technical people...so, I wanted to use FS, to display the data as readable, but wanted to map this to a COMP-3 copybook (which is actually more difficult but I have to stick to my guns).

so, would I change my sort cards as follows (I feel like I'm so close):

SORT FIELDS=(1,1,BI,A)
OUTREC FIELDS=(1,2,BI,TO=PD,LENGTH=1,X,
3,2,BI,TO=PD,LENGTH=3,X,
5,8,BI,TO=PD,LENGTH=5)
OPTION HIPRMAX=OPTIMAL


Coded - do it yourself next time
chillmo
 
Posts: 11
Joined: Wed Aug 30, 2017 8:56 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Can SyncSort convert data types.

Postby Robert Sample » Thu Aug 31, 2017 8:12 am

It is not at all clear what you are trying to do. If you need to display the values, then COMP-3 (which, by the way, is a COBOL-specific term -- when using a SORT product the term for these values is packed decimal) is not necessarily the way to do it. You get two decimal values per hex character (except for the last byte which has 1 decimal digit and the sign) so it is still in hexadecimal format. If you want to display the value for a field, you should be converting to zoned decimal (ZD) which is (mostly) human readable (the sign overlay will change the last byte to a character instead of a number).

Converting a two-byte COMP value to a 1-byte packed decimal value is not good -- a 1-byte packed decimal can only hold a 1 digit value whereas the 2-byte COMP value, depending upon the source, could require up to 5 digits (or 3 bytes total). Similarly, a 5-byte packed decimal value has room for 9 digits whereas an 8-byte binary (COMP) value can be up to 18 digits (in COBOL at least). So 2 of the 3 sample conversions you posted have the potential to overflow by many digits.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Can SyncSort convert data types.

Postby chillmo » Thu Aug 31, 2017 9:42 am

Yes, I want to display the values, with a comma or space between each field via sort, for the non-technical people. NOT sure how to accomplish this....help!!!
chillmo
 
Posts: 11
Joined: Wed Aug 30, 2017 8:56 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Can SyncSort convert data types.

Postby chillmo » Sat Sep 02, 2017 10:29 pm

I need to revise my original question based on some incorrect information......

The input file was created based on the layout below but it's in hex format. I'm struggling with how to convert these values as PD, using the same field lengths...meaning APP-CODE should still be PIC 9(1) and so forth, to be processed in batch.

05 GBB-APP-CODE PIC 9(01) COMP.
05 GZZ-INST-NBR PIC 9(03) COMP.
05 GCC-ACCT-NBR PIC 9(10) COMP.

This is how the input file looks...
2709005
0249965

APP-CODE equals 2
INST-NBR should be 072
ACCT-NBR should 0499090655

I tried using the sort card OUTREC FIELDS=(1,1,1,1,TRAN=UNHEX) but this didn't work.

Any suggestions would be very appreciated!
chillmo
 
Posts: 11
Joined: Wed Aug 30, 2017 8:56 pm
Has thanked: 1 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post