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

Copying records from an input VB file to an output VB file


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

New User


Joined: 26 Dec 2007
Posts: 18
Location: Chennai, India

PostPosted: Tue Nov 18, 2008 12:55 pm
Reply with quote

Hi,
The space in the subject line was not enough for me to give the short description of the problem. I am sorry for that.

We are facing some problem with an ICETOOL job and in need of some help.

We have a requirement which goes like this.

We have an input VB file with maximum length suppose 500.

The record format in the file is
<First Fixed field having length of 100><Variable field of X length><Second Fixed field having length of 50> (X can be any thing from 1 - 350)

Now according to my requirement we have to copy the data from this input VB file to an output VB file having a maximum length of 400.
If the actual total record length is more than 400 then truncation is fine from the variable length field. But the fixed length fields should be retained as it is.


There are some key values which denote the start of the fixed fields.

For example: in the beginning of the <Second Fixed field having length of 50> we will have a value “HEADER: ” which will be same for all the records. The rest of the field value will differ but finally the length of the fixed field will be same (i.e. : 50).

The problems we are facing are:

Primary Problem:
How to find the position of the first character of <Second Fixed field having length of 50>?

Secondary problem:
If we can find the starting position of <Second Fixed field having length of 50>, we were thinking that we can put the first fixed field, then the variable field’s first 250 characters and then the second fixed field. But we are clueless what to do if the length of the <Variable field of X length> is less than 250. In that case some part of the second fixed field may get included in that 250 characters.

Can any one help us out on this? It is possible that the approach we have taken is not correct. All ideas are welcomed.

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 18, 2008 5:44 pm
Reply with quote

You may want to consider writing a program to handle this -- then you could code up the logic to do what you need.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 19, 2008 12:27 am
Reply with quote

It isn't clear from your description what you want to do. An example of input records and expected output records would help.

You can use DFSORT's PARSE function to find and extract the data starting with 'HEADER'. For complete details on PARSE, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
sourav_dasgupta

New User


Joined: 26 Dec 2007
Posts: 18
Location: Chennai, India

PostPosted: Wed Nov 19, 2008 9:25 am
Reply with quote

Thanks Frank,
I have used PARSE to extract the variables.
the sample jcl goes like

Code:
OPTION COPY

INREC  PARSE=(%00=(FIXLEN=100),

              %01=(ENDBEFR=C’ HEADER:’,FIXLEN=250),

              %02=(FIXLEN=50)),

       BUILD=(1,4,5:%00,105:%01,355:%02)

OUTREC BUILD=(1,4,400,SQZ=(SHIFT=LEFT,PREBLANK=C' '))


I am reconsidering usage of SQZ though as for me it is sqeezing the spaces present any where with in the actual value.
I am trying to trim only the trailing spaces from %01(which may come if the actual length of %01 is <250). Any existing spaces in the middle of %01 is expected to be retained as it is. This is just to make sure that the spaces which are added by the parse function is removed (file system space constraint)

Can any one help?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Nov 20, 2008 2:25 am
Reply with quote

sourav_dasgupta,

use the following control cards which will give you the desired results. Since you wanted the preserve the spaces in between we left justify the variable string and then enclose the variable string in double quotes and the last field in double quotes and then use SQZ function to trim the trailing spaces in the variable field.

We also use the new FINDREP function of DFSORT to find and remove the double quotes we added. For complete details on FINDREP, see:
Use [URL] BBCode for External Links


Code:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=INIT,                             
  PARSE=(%00=(ABSPOS=105,ENDBEFR=C'HEADER:',FIXLEN=250)
         %01=(FIXLEN=43)),                             
  BUILD=(1,104,C'"',%00,JFY=(SHIFT=LEFT,TRAIL=C'"'),   
         C'"HEADER:',%01,C'"')),                       
  IFTHEN=(WHEN=INIT,                                   
  BUILD=(1,104,105,300,SQZ=(SHIFT=LEFT,PAIR=QUOTE))), 
  IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C''))         
/*                                                     


Hope this helps...

Cheers
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top