Reformat Output file

I have a file having 1000 records and each record having 8 fields, but i want to output having 1,3,5,7 fields only, then how can i achieve this criteria?

Questions by rpg0247   answers by rpg0247

Showing Answers 1 - 2 of 2 Answers

babjee talluri

  • Jul 26th, 2011
 

but we know the length of the field, if we know the length, if it's wrong let you tell me asap, i am fresher

perform until 1000 times
read file1rec
move(1:10) to a(1:10)
move(30:10) to a(12:10)
move(50:10) to a(24:10)
move(70:10) to a(36:10)
display a
end-perform.

  Was this answer useful?  Yes

sandeep

  • Nov 24th, 2011
 

Using sort in jcl we can get the required fields in output file like,

Code
  1. in sort jcl,

  2. //sysin dd *

  3.   sort fields=copy

  4.   outrec fields=(starting position in o/p file:starting field in i/p file,length,starting position in o/p file:starting field in i/p file,length,..........)

  5. /*

  6. //

  7. e.g. assume i have 8 fields in one rec of i/p file each field length 5 bytes, as he ask i want 1,3,5,7 fields only, see

  8. //sysin dd *

  9.   sort fields=copy

  10.   outrec fields=(1:1,5,6:11,15,11:21,25,16:31,35)

  11. /*

  12. //

  13.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions