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

Extract File Length in DSNUTILB


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

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Sun Apr 19, 2009 5:35 pm
Reply with quote

Hi Friends,
I used DSNUTILB program to extract a DB2 table. The extract file is in VB format with length 302. Acc to the DCLGen, the length of the table is 296 bytes. To convert it into FB, i used the following logic in DFSort:

Code:
//STEP20 EXEC PGM=SORT                     
//SORTIN DD DSN=USERID.DB2TBL.EXTRACT,     
//       DISP=SHR                           
//OUTPFIL DD DSN=USERID.DB2TBL.EXTRACT.FB,
//      DISP=(NEW,CATLG,DELETE),           
//      SPACE=(TRK,(10,10),RLSE),           
//      UNIT=DISK
//SYSIN  DD *                               
 SORT FIELDS=COPY                           
 OUTFIL VTOF,FNAMES=OUTPFIL,VLFILL=C' ',   
        OUTREC=(1:5,296)                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG DD SYSOUT=*                       
//SYSOUT DD SYSOUT=*


As in any VB file, first 4 bytes are RDW, and data starts from the 5th byte, i used OUTREC=(1:5,296).

But i am getting 2 extraneous characters(..) in the beginning of each record and the whole record is shifted to the right by these 2 characters.

Later when i used OUTREC=(1:7,296) the output was correct. Can anybody explain why use 7 and not 5 as the starting position as used for any VB file.

Thanks,
Asif.
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Sun Apr 19, 2009 5:43 pm
Reply with quote

I also used the following code but got the same first characters(..) and whole record got shifted right

Code:
//STEP10  EXEC PGM=ICEGENER                     
//SYSIN  DD *                                   
 GENERATE MAXFLDS=1                             
 RECORD FIELD=(296,1,,1)                       
/*                                             
//SYSPRINT DD SYSOUT=*                         
//SYSUT1 DD DSN=USERID.DB2TBL.EXTRACT,DISP=SHR
//SYSUT2 DD DSN=USERID.DB2TBL.EXTRACT.FB,     
//       DISP=(NEW,CATLG,DELETE),               
//       DCB=(RECFM=FB,LRECL=296),             
//       SPACE=(CYL,(1,1),RLSE),UNIT=SYSDA     
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun Apr 19, 2009 6:50 pm
Reply with quote

How about a hex display of the front part of both a VB and an FB record?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Apr 19, 2009 9:33 pm
Reply with quote

4 for the RDW and probably 2 for the first column which is varchar?

if you don't want any more guesses, provide us with the select statement and the table def.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Apr 19, 2009 10:39 pm
Reply with quote

4 for the RDW and 2 for the table ID.
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Mon Apr 20, 2009 11:12 am
Reply with quote

Thank You very much Craq Giegerich ! icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Apr 20, 2009 10:02 pm
Reply with quote

vasif,

You don't even have to convert from VB to FB. Take a look at your SYSPUNCH dd from your unload step , It will list all the columns which are null and varchar columns with positions. You can use the functions IFNULL, VALUE, COALESCE to have default values for them. For VARCHAR fields use the function CHAR to make them char data. By doing this you can avoid the conversion of the file from VB to FB
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top