Question on SYNCSORT - Treat CHAR as HEX and CONVERT

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
bharath.gct
Member
Posts: 7
Joined: Sat Mar 31, 2012 8:16 am

Question on SYNCSORT - Treat CHAR as HEX and CONVERT

Post by bharath.gct » Sun Apr 01, 2012 9:04 pm

Hi All,

My requirement is given below: (HEX is ON in all Rows. We are running SYNCSORT version 1.3.0.2R.)


I/p File:

Code: Select all

----+----1----+----2----+----3----+----4----+----5----+----6---
 --------------------------------------------------------------
********************************* Top of Data *****************
                                                               
                                                               
 --------------------------------------------------------------
1716217162NAME14A231D24C96649E98020992941381BFA0100C36A0100C36B
FFFFFFFFFFDCDCFFCFFFCFFCFFFFFCFFFFFFFFFFFFFFCCCFFFFCFFCFFFFCFFC
171621716251451412314243966495980209929413812610100336101003362
 --------------------------------------------------------------
1716317163NAME24A231D24C96649E98020992941381BFB0100C37A0100C37B
FFFFFFFFFFDCDCFFCFFFCFFCFFFFFCFFFFFFFFFFFFFFCCCFFFFCFFCFFFFCFFC
171631716351452412314243966495980209929413812620100337101003372
 --------------------------------------------------------------
******************************** Bottom of Data ***************
The input contains 6 fields
1. ID - 1 to 5
2. BaseID - 6 to 10
3. Name - 11 to 15
4. ExtendedID - 16 to 47
5. FirstNumber - 48 to 55
6. SecondNumber - 56 to 63

My o/p file should look like:

Code: Select all

----+----1----+----2----+----3----+----4----+----5----+----6---
***************************** Top of Data *********************
1716217162NAME1¢   IÃñZØ r    ³                  C¦      C,    
FFFFFFFFFFDCDCF4212C64E8292431F444444444444444400C6444400C64444
171621716251451A3D49699009918BA0000000000000000103A0000103B0000
---------------------------------------------------------------
1716317163NAME2¢   IÃñZØ r    Û                  C:      C#    
FFFFFFFFFFDCDCF4212C64E8292431F444444444444444400C7444400C74444
171631716351452A3D49699009918BB0000000000000000103A0000103B0000
---------------------------------------------------------------
**************************** Bottom of Data *******************
In fields 4, 5 and 6, I want to write the data that is present as CHAR representation back to HEX representation in output. I think my i/p and o/p values will make you understand my requirement better. Anyway please let me know if you have any questions.

Thanks,
Bharath

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sun Apr 01, 2012 11:40 pm

How did these fields get "expanded" in the first place? I suspect that they were/are available in the format you want . . .

When the file is created, why not use the original values rather than expanding them?
Have a good one

bharath.gct
Member
Posts: 7
Joined: Sat Mar 31, 2012 8:16 am

Post by bharath.gct » Mon Apr 02, 2012 2:01 am

I generated them using a .Net application. These are the GUIDs (Global unique IDs) and they are always generated in the number format. i.e. It is THE original format.

But unfortunately I have to load them to Teradata as BYTE type. So if my Mainframe file has them as characters, they are not getting loaded. And for that, I need my mainframe file converted.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Apr 02, 2012 9:06 pm

Suggest you open an issue with Syncsort support. . . There may be a way of doing this with Syncsort, but i'm not aware of it.

What you want can very easily be done with a bit of COBOL code.
Have a good one

bharath.gct
Member
Posts: 7
Joined: Sat Mar 31, 2012 8:16 am

Post by bharath.gct » Mon Apr 02, 2012 10:04 pm

Thanks. I thought this section in the forum included SYNCSORT support as well. Can you please let me know the correct section so that I can move this question there?
Thanks
Bharath

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Apr 02, 2012 11:42 pm

My bad - i wasn't clear. . . :oops:

This is the proper part of this forum for Syncsort questions.

When i mentioned "Syncsort support", i was referring to the product support at Syncsort - not part of this forum.
Have a good one

bharath.gct
Member
Posts: 7
Joined: Sat Mar 31, 2012 8:16 am

Post by bharath.gct » Tue Apr 03, 2012 1:25 am

Oops! I didnt think of it that way. let me do that as well.

Also, can you tell me how do we do it in COBOL? Sorry I was very optimistic that this was a small request and can very well be handled by SORT cards itself.
Thanks
Bharath

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue Apr 03, 2012 11:48 pm

One way is to set up a 256 entry array of 2 elements each. The first element would be the "expanded" value (your input - say pic xx value '00') and the second element would be the one byte hex value for that element - x'00'.

This array would be from pic xx value '00' thru 'FF' and hex values would also be from x'00' thry x'FF'.

Search the array for the 2-byte value and use the corresponding hex value for your result.
Have a good one

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Wed Apr 04, 2012 2:56 pm

I believe this question is active in other Forum as well!
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others