Posted: Fri Dec 20, 2002 1:06 am Post subject: Counting and appending a constant
Dear All,
I have a doubt. Say, I have a 1000 records. Now, can I append a constant, say at the end of every 50 records. Hence, there would be a constant at the 50th, 100th, 150th records and so on... Is it possible ???
Prem,
Thanks for the quick reply. But as per what you said, I need to code about 20 outrec statements (for 1000 records) . Is there any method to do it ??
I coupled removing the SEQNUM with OUTREC itself.
Your output file will be FB85 with every 50th record having '12345' appended and other records having 5 blanks appended.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Dec 20, 2002 9:37 am Post subject:
Rajvasan,
Premkumar's solution will work for any number of records.The solution has to be changed only when you need it for some other sequence.Right now you are changing every 50th record to have a constant value.If tommorrow you decide to change it to every 25th record , then you need to change the control cards as follows:
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Dec 20, 2002 10:07 am Post subject:
Rajvasan,
You don't have to code all the control cards as you showed.Since the seqnum is only 2 bytes,it will start over once again from 01 after every 100 records.To explain this clearly , let us say your file has 250 records.
so the seqnum will be
Code:
01
02
...
50
...
00 - 100th record
01 - 101 record
...
50 - 150th record
....
00 - 200th record
01 - 201 record
..
50 - 250th record
So the seqnum keeps starting from 1 for every 100 records.This is applicable for 'n' no: of records in your input file.Since we want to change only multiples of 50, all we need is to change control cards for records which has seqnum 00 & 50
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