Unable to add space for particular fields from the inp file



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

Unable to add space for particular fields from the inp file

Postby tjegan » Thu Nov 06, 2014 7:56 pm

Hi All,

I have a control card like the below:
Record length of both input and output file is 620 and it is fixed format.

when i try copy the record from input file using overlay statemnt, it is working fine for 01 type record.
SORT FIELDS=COPY                                         
OUTREC IFTHEN=(WHEN=(81,2,CH,EQ,C'01'),OVERLAY=(1:1,181,
182,21,203,21,224,21,                                   
245,21,266,21,287,21,                                   
308,21,329,21,350,21,                                   
371,21,392,21,413,21,                                   
434,21,455,21,476,145))                                 

Input file:
6----+----7----+----8----+----9----+----0----+----1----+-
************** Top of Data ******************************
           5165550290H V       N5165550290BAV       N   

Output file:
6----+----7----+----8----+----9----+----0----+----1----
************** Top of Data ****************************
           5165550290H V       N5165550290BAV       N 

But i want to insert a space inbetween few fields(i mentioned as X from the below control card)
For example, In the ouptput file, i need a space in 204th position and 205th position should contains
the value from the input file(203 to 21 length)..

SORT FIELDS=COPY                                                 
OUTREC IFTHEN=(WHEN=(81,2,CH,EQ,C'01'),OVERLAY=(1:1,181,182:X,   
182,21,204:X,203,21,226:X,224,21,248:X,                           
245,21,270:X,266,21,292:X,287,21,314:X,                           
308,21,336:X,329,21,358:X,350,21,380:X,                           
371,21,402:X,392,21,424:X,413,21,446:X,                           
434,21,468:X,455,21,490:X,476,145))                               


When i try with the below control card i am getting unexpected result. I have also tried with C' ' but invain. So can any one please correct me on this.
output:
6----+----7----+----8----+----9----+----0----+----1----+-
************** Top of Data ******************************
           5165550290H  V       N5165550290B B        N 


Expected output
6----+----7----+----8----+----9----+----0----+----1----+-
************** Top of Data ******************************
           5165550290H  V       N5165550290B AV       N


Thanks
Jegan.
tjegan
 
Posts: 34
Joined: Mon Mar 25, 2013 5:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to add space for particular fields from the inp file

 

Re: Unable to add space for particular fields from the inp f

Postby BillyBoyo » Thu Nov 06, 2014 8:13 pm

With OVERLAY, you can't insert, you can only overwrite.

OVERLAY operates on the current (version) of the input record. BUILD creates a new current record, every time it is used. So BUILD can refer to positions which have not been destroyed by the result of the BUILD. If OVERLAY is used on a position which has already been changed earlier in the OVERLAY, then that changed data is what you get.

For instance, you have 182:X,182,21. That is always going to replace your data by one leading blank. On a BUILD, 182:X,182,21 would work as you expect, although unless you wanted blanks before the X, you'd probably not need to bother having the 182: anyway.

If you want to "insert" a couple of blanks, how are you going to get around the fact that that will make the record longer?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Unable to add space for particular fields from the inp f

Postby tjegan » Fri Nov 07, 2014 11:33 am

Many thanks for the clarification. I tried replacing with Build statement and got the expected output. :)
tjegan
 
Posts: 34
Joined: Mon Mar 25, 2013 5:58 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post