Length VB file records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Length VB file records

Postby gauravfrankly » Wed Aug 12, 2015 3:00 pm

I have a VB file as input and want to get output with length of each record in VB file.
Can you please give me a sort JCL to do this.
How we could use RDW to get this Length.
gauravfrankly
 
Posts: 39
Joined: Fri Aug 07, 2015 3:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length VB file records

Postby NicC » Wed Aug 12, 2015 3:38 pm

What have you tried so far? Have you looked up the format of the RDW?
I presume you do not actually want the sirt JCL, as that is very clearly explained in the manual, but the sort control cards (which are not JCL).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Length VB file records

Postby gauravfrankly » Wed Aug 12, 2015 3:56 pm

Sorry, Nicc. can you please give me sort control card to fetch the length from RDW.
I didn't got any thing by googling it.
gauravfrankly
 
Posts: 39
Joined: Fri Aug 07, 2015 3:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length VB file records

Postby gauravfrankly » Wed Aug 12, 2015 4:03 pm

http://www.caliberdt.com/tips/Aug05_Var ... DW_BDW.htm

can you plz explain, what they trying to do. just click th link!!
gauravfrankly
 
Posts: 39
Joined: Fri Aug 07, 2015 3:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length VB file records

Postby BillyBoyo » Wed Aug 12, 2015 5:16 pm

 OPTION COPY
 OUTFIL VTOF,BUILD=(1,2,BI,ZD,LENGTH=5)


The record-length is a binary value in the first two bytes of the RDW (Record Descriptor Word). The above will produce fixed-length records of five bytes which contain the record-length.

What do you actually want to do with the record-length?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Length VB file records

Postby steve-myers » Wed Aug 12, 2015 6:21 pm

gauravfrankly - we try to avoid links to non IBM web sites here. Many of us will not follow these links.

I have to echo Billyboyo: what do you propose to do with this data? Most use of this data that I can imagine is purely statistical in nature: what is the average length of data records? What are the shortest and/or the longest record lengths?

Billyboyo - Will DFSORT produce a true zoned decimal value or does it produce a zoned decimal value with the alternate "sign" X'Fx' rather than X'Cx'?
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Length VB file records

Postby BillyBoyo » Wed Aug 12, 2015 7:00 pm

In this instance, it will produce an X'Fx'. If you want the X'Cx', you can use ZDC instead of ZD as the "TO" field-type.

ZD is a data-type, where it is associated with a start-position and a length. TO=ZD is a conversion. It converts contextually. If it is the wrong conversion for the task, or by choice, TO=ZDF or TO=ZDC may be used. ZD without a start and a length is a conversion (as in my example) short for TO=ZD. In this context it will produce an "unsigned" value - if I wanted a signed value, I would make the conversion TO=ZDC, or plain ZDC, in place of the ZD.

I usually include the TO= to make things clearer. As an expedient (since it was handy) I copied and amended someone else's code, which does the job, but doesn't have the TO=. :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Length VB file records

Postby gauravfrankly » Mon Aug 17, 2015 3:40 pm

Billy,
I need to insert the length into DB. and I want a datset like following:
input:
gaurav
billy
frank
output:
gaurav 06
billy 05
frank 05
gauravfrankly
 
Posts: 39
Joined: Fri Aug 07, 2015 3:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length VB file records

Postby BillyBoyo » Mon Aug 17, 2015 5:12 pm

Assuming you input is a variable-length dataset:

  OPTION COPY
  INREC  IFTHEN=(WHEN=INIT,
                 OVERLAY=(31:1,2,BI,SUB,+4,TO=ZD,LENGTH=2))
  OUTFIL VTOF,BUILD=(5,32)


You'd need to subtract four from the record-length (to account for the RDW). I've assumed you want the output in fixed positions.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post