Joined: 08 Dec 2005 Posts: 17 Topics: 6 Location: India
Posted: Tue Jul 14, 2009 6:23 am Post subject: Construct a new file with selected first line column value
Hi All,
I have searched many topics to find out any examples related to my requirement, but do not find any. Please help me on this. Thanks in advance.
Requirement ...
If my second record is "90000000000000000000000000" (Pls check my input file, line # 2) then create a single line output file - output file format #1 (conditions are mentioned below), else don't change anything, just copy all the lines to output file (Output file format #2).
P.S.: Only one output file, if the above condition matches then create format #1, else format #2.
Conditions (to create OUTPUT FILE FORMAT #1)...
1) First field - cycle date (extract it from line one, last column of i/p file. Field starts @ 18, length is 8 ).
2) Following that fill up with no '9'
Joined: 08 Dec 2005 Posts: 17 Topics: 6 Location: India
Posted: Mon Jul 20, 2009 9:52 am Post subject:
Kolusu,
Sorry to ask question again in the same topic. Small change in the requirement. Constantly I will not get the following value as my second record (previously it was not the case, this is the only change right now).
Current logic push the value "Y" once it finds the char "Y" @ 51st column. So that all "NN" rows (next to "YY") will become as "NY". The include cond will omit these "NY" rows. In this case, I will have only "YY" selected row. You gave this based on my requirement.
Suppose, my input file has the cond value "90000000000000000000000000" at line 5 (it may vary), then I don't know how to omit first 4 lines/What logic to use it here ? I tried out many ways, but not able to traverse back and set any values (here, first 4 lines). Kindly help me on this. Thanks.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Jul 20, 2009 10:30 am Post subject:
bala,
The job can be modified but the question is do you want to retain the header records? Lets say you found the record "90000000000000000000000000" at line 200 what do you want to do with the first 199 lines? Do you need them? _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 08 Dec 2005 Posts: 17 Topics: 6 Location: India
Posted: Tue Jul 21, 2009 3:56 am Post subject:
Thanks for your response.
Quote:
Lets say you found the record "90000000000000000000000000" at line 200 what do you want to do with the first 199 lines? Do you need them?
Say for example, my input file has 300 lines, and 200th line has "90000000000000000000000000" then I want 1 line output file ("90000000000000000000000000" should be replaced by cycle date & 9s - please refer my OUTPUT FILE FORMAT #1 & it's conditions). So, in our case, the first 199 and last 100 records should be ignored. Else (if there is no "90000000000000000000000000" record in my input file,) print all 300 records into output file (i.e. both input and output files should have same content).
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Jul 21, 2009 11:17 am Post subject:
bala,
Use the following Control cards. I still assumed that your first record in your input file has the DATE which you need in pos 18. This job looks for the record with "90000000000000000000000000" and if found will only write the record modifying it or else it will copy the input as is
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum