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

Can we convert whole record from comp-3 to readable format?


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

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Sat Sep 29, 2012 10:02 pm
Reply with quote

Code:
TRAILER..Å.@..Å.@.......Î.@....@.................éÃ%...-........................
TRAILER...Ã@...Ã@.......îí....ã........................&<...................ð...

I have 2 records in file, which is comp-3 after the initial 7 bytes. The record is made up of multiple fields but I want to know if the whole record can directly be converted from comp-3 to a readable format using DFSORT.

Any suggestions?

Code'd
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: Sat Sep 29, 2012 11:05 pm
Reply with quote

You mean some sort of magic without having to code it out? No.

Probably the easiest way would be with symbols/SYMNAMES. If you have a Cobol layout, there is some REXX supplied which you can use/customise to generate the symbols. If you have some other type of layout, it shouldn't be difficult either, but at the end of the day you'll still have to code for each field, even if the symbols take care of the start-position and length for you.
Back to top
View user's profile Send private message
kkxlnc

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Sat Sep 29, 2012 11:10 pm
Reply with quote

Ok. I thought there would be some sort of magic in Sort so wanted to check before I start doing it field by field. I will do it the traditional way.

Thanks for the quick response.
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: Sun Sep 30, 2012 12:01 am
Reply with quote

Well, there are lots of magical things in DFSort, but giving it a lump of various packed-decimal fields and turning them into something else is not one of them :-)
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: Sun Sep 30, 2012 12:11 am
Reply with quote

Hello,

Do you have a cobol copybook of both the old and the new format?

If yes, your task might be as simple as a read, a move corresponding and a write . . .

I'm not aware of an automagic solution in a sort product or other utility that does Not have the equivelent of "copybooks".
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Sep 30, 2012 12:12 am
Reply with quote

do You realize that what You posted is just plain garbage...

go to ISPF... browse the dataset object of the question
type HEX ON and paste a couple of records so that we can see
the Hex representation of Your data

USE THE CODE TAGS to preserve the proper aligment

tell the fields that You want to <display> in a readable format
position/length of each
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: Sun Sep 30, 2012 3:13 am
Reply with quote

enrico, with unusual initiative, KK is doing it the "traditional" way - coding it out themselves. They are to be congratulated. No-one here is going to type-up a load of conversions of PD to ZD. If there is a problem with a particular format, an example will probably be provided or hints given as to where to look in the manual.

Dick, DFSort (and the other one) does have "copybooks" (symbols). No "MOVE CORRESPONDING" though :-)
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: Sun Sep 30, 2012 7:43 am
Reply with quote

Yup, the ability to use "symbols" is there but if they have not already been defined, this will take a while also. . .

And there may be problems with the initial set of definitions . . .

I've wondered for years why none of the sort products have chosen to support the datanames used in a copy book. The copybook name might be associated with the ddname and the "name" used in place of length,displacement,type?

Maybe there are reasons this would not be desirable?

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

Global Moderator


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

PostPosted: Sun Sep 30, 2012 2:25 pm
Reply with quote

Quote:
Maybe there are reasons this would not be desirable?

Maybe because of the differnet coding rules for different languages that sort - or any utility - would have to cater for e.g. COBOL, PL/1, Fortran, C etc It is supposed to be a genreal purpose utility so as soon as you start pandering to one language or another it becomes non-general.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Sep 30, 2012 8:58 pm
Reply with quote

See the "Create DFSORT Symbols from COBOL Copybook" Smart DFSORT Trick at:

Use [URL] BBCode for External Links
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: Mon Oct 01, 2012 1:49 am
Reply with quote

Hello,

@Nic
Yup, upon reflection, i agree. While "everywhere" i've ever been use COBOL the most, nearly everywhere also has the other languages available. And the "sort" is meant to be generic . . . So, i take back the question icon_cool.gif

@Enrico,
Thanks for the reminder - had completely forgotten this icon_redface.gif

d
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 Oct 01, 2012 3:32 am
Reply with quote

Easytrieve Plus doesn't "natively" have copybooks. It does have parameter-substitution macros. Again the Easytrieve Plus record-layouts could be generated (CA supply a little something as a possible starting point).

If "analysis/design" holds file definitions centrally, per life-cycle stage, then any and all record-layouts for any language/utility should/could be generated from there.

Across multiple languages/utilities you have the "impact analysis" problem of potentially different names. At least if held centrally, all the names should be known.

As I have mentioned before, I find the DFSort Symbols/SYMNAMES, invented by the now-retired Frank Yaeger, incredibly useful. There are "general" solutions that I can write which then only require changes to the symbols to work on completely different files with completely different data. I don't have to touch the code itself. I am stunned by the evidence in this forum of how little DFSort Symbols are used.

With generated Symbols/SYMNAMES you don't get the definition of the data wrong... many typos will not get past the basic checking by DFSort (misspelled Symbols). Unlike when coding start,length,type by hand.

Now, for the task of the TS (they are already off and running with it) symbols aid "half" of the task. Symbols always define source fields only, never the "target" in BUILD/FIELDS/OUTREC/OVERLAY/PUSH (unlike Cobol, PL/I, Easytrieve Plus). With the Symbols, the only "half" of the task remaining is the conversion or EDITing.
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: Mon Oct 01, 2012 7:06 am
Reply with quote

Hello,

As far as Easytrieve goes, there is a set of macros that come with the product that will convert a cobol copybook to an Easytrieve layout.

As far as i know, there is still a problem certain kinds of repeating fields, but i've not generated a new Ezt layout for a few years. I seem to remember the problem(s) had to to with ODO or possibly multi-dimension.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 05, 2012 1:00 am
Reply with quote

kkxlnc wrote:
Code:
TRAILER..Å.@..Å.@.......Î.@....@.................éÃ%...-........................
TRAILER...Ã@...Ã@.......îí....ã........................&<...................ð...

I have 2 records in file, which is comp-3 after the initial 7 bytes. The record is made up of multiple fields but I want to know if the whole record can directly be converted from comp-3 to a readable format using DFSORT.

Any suggestions?

Code'd


Well if you are just happy to see the readable digits in the PD field you can use HEX function and you will be able to convert the entire array of PD fields to readable format.

ex: A 5 byte PD field with a value of 1 will be stored as X'000000001C' and -1 will be stored as X'000000001D'

Using Hex function you can translate that 5 bytes to 10 bytes as 000000001C.

Note that the sign is trailing. We can use a FINDREP to replace the positive values(C,F) to a + or space and the negative values (B,D) to -

something like this. I assumed that you have 10 pd fields from position 8 each with a length of 5.
Code:

//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC BUILD=(1,7,8,50,HEX)                                     
  OUTREC FINDREP=(STARTPOS=8,                                     
                  INOUT=(C'C',C'+',C'F',C'+',C'B',C'-',C'D',C'-'))
//*                                                                                                                           
Back to top
View user's profile Send private message
kkxlnc

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Fri Oct 05, 2012 3:03 am
Reply with quote

I tried this:

TRAILER000167237+000167237+000000000+000076187+000005067+000000000+000000001+000
TRAILER000136667+000136667+000000000+000056550+000004463+000000000+000000000+000

and it works like a charm. Exactly what i was looking for. Thank you very much.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top