Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copying records from an input VB file to an output VB file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copying records from an input VB file to an output VB file
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue Nov 18, 2008 5:44 pm    Post subject:
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 Moderator


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

PostPosted: Wed Nov 19, 2008 12:27 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/peug/
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    Post subject:
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    Post subject:
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:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/


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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us