View previous topic :: View next topic
|
Author |
Message |
suneelk
New User
Joined: 23 May 2022 Posts: 1 Location: India
|
|
|
|
I have a file with logical record length of 80. From columns 53-80 - I need to search for five digit company id then write the same to output file. Input file is having company id any where between 53-80 columns that includes description as well. Please advise a sample program. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 1650
|
|
|
|
suneelk wrote: |
I have a file with logical record length of 80. From columns 53-80 - I need to search for five digit company id then write the same to output file. Input file is having company id any where between 53-80 columns that includes description as well. Please advise a sample program. |
Quote: |
1) Read your input data, one record at the time.
2) For each record, compare its ID field with the value you are interested in.
3) If match is found, then write the currently read record into your output dataset; otherwise do nothing.
4) When input data ended, stop run the program; otherwise continue to #1. |
That is the advice.
P.S.
There are hundreds, and hundreds of sample programs in tons of existing manuals and references on COBOL programming, if you had ever seen any... |
|
Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 394 Location: Inside the SPEW (Cincinnati OH USA)
|
|
|
|
"value you are interested in"
Old school method is looping using reference modification until you have entered 5 consecutive numeric digits. Still may be erroneous as it assumes only a single occurrence of a 5 digit number and ignores 6 or more digit numbers being present. |
|
Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 394 Location: Inside the SPEW (Cincinnati OH USA)
|
|
|
|
Quote: |
using reference modification until you have entered 5 consecutive numeric digits |
should be: using reference modification until you have found 5 consecutive numeric digits |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 2963 Location: NYC,USA
|
|
Back to top |
|
 |
|