Can someone tell how to skip first record of a sequence file.
get file1
**any skip comment are there to skip the first recoed** ?????
**logic**
put file2
How to skip the first records
-
- Posts: 30
- Joined: Sat Dec 11, 2010 9:44 am
- Skillset: JCL, REXX, DB2
- Referer: Google
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: How to skip the first records
Hello,
One easy way is to count the records read and when the count is 1, skip the record.
Another is a first-time indicator/switch.
One easy way is to count the records read and when the count is 1, skip the record.
Another is a first-time indicator/switch.
Hope this helps,
d.sch.
d.sch.
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to skip the first records
Code: Select all
IF RECORD-COUNT (FILE1) EQ 1
GO TO JOB
END-IF
-
- Posts: 30
- Joined: Sat Dec 11, 2010 9:44 am
- Skillset: JCL, REXX, DB2
- Referer: Google
Re: How to skip the first records
Thank Deck and Billy boya.. i will try and publish the working code..
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to skip the first records
Thanks for the thanks.
My quick solution assumed that you have "JOB INPUT NULL", ie you are doing the reading yourself, but basically just reading the main file.
If you are reading some sort of subsidiary file, then
Why do you want to ignore the first record? If it is a file header, it would be better to identify it as such, and ignore it specifically because it is a file header, rather than just the first record. The file header may (should) have data on which you can check in the program that you are reading the right file (right day, right name, whatever). If there is a file header, is there a file trailer? If so, should identify it and again verify any data on it (record count, total of any fields (hash counts)).
It may seem a waste to do all this stuff, but it can save you a lot of time, and once you have your first program working, you can "clone" it for the next one, so don't have to repeat the coding of the header/trailer each time, just the checking.
My quick solution assumed that you have "JOB INPUT NULL", ie you are doing the reading yourself, but basically just reading the main file.
If you are reading some sort of subsidiary file, then
Code: Select all
IF RECORD-COUNT (FILE1) NE 1
PERFORM whatever-file-processing-you-want
END-IF
Why do you want to ignore the first record? If it is a file header, it would be better to identify it as such, and ignore it specifically because it is a file header, rather than just the first record. The file header may (should) have data on which you can check in the program that you are reading the right file (right day, right name, whatever). If there is a file header, is there a file trailer? If so, should identify it and again verify any data on it (record count, total of any fields (hash counts)).
It may seem a waste to do all this stuff, but it can save you a lot of time, and once you have your first program working, you can "clone" it for the next one, so don't have to repeat the coding of the header/trailer each time, just the checking.
-
- Posts: 31
- Joined: Wed Feb 16, 2011 7:08 pm
- Skillset: Old Warrior - Proficient in Asm, Cobol and Easytrieve (and other stuff)
- Referer: Looking for something easytrieve related
Re: How to skip the first records
Old timer question: is a new syntax?? It used to be filename:RECORD-COUNT (I'm pretty sure of that!)
Code: Select all
RECORD-COUNT (FILE1)
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to skip the first records
Zio69 wrote:a new syntax?? It used to be filename:RECORD-COUNT (I'm pretty sure of that!)
You're right. Sometimes I check what I think I know, the times I don't it asks for trouble.
Sorry, sjrcreation, use Zio69's code.
-
- Posts: 30
- Joined: Sat Dec 11, 2010 9:44 am
- Skillset: JCL, REXX, DB2
- Referer: Google
Re: How to skip the first records
Hi all, Thanks for ur repond. Zio69's code is working
so
IF file1:RECORD-COUNT NE 1
PERFORM logic1
END-IF
working
so
IF file1:RECORD-COUNT NE 1
PERFORM logic1
END-IF
working

-
- Similar Topics
- Replies
- Views
- Last post
-
- 4
- 10343
-
by Misha786
View the latest post
Tue Jul 18, 2023 11:26 pm
-
-
Skip last 3 bytes and first 3 bytes of data in cobol
by senthamizh » Wed Dec 21, 2022 7:26 pm » in IBM Cobol - 2
- 1804
-
by Robert Sample
View the latest post
Thu Dec 22, 2022 9:18 am
-
-
-
Insert records from File1 between records of File2
by Daouchiche » Wed Nov 10, 2021 6:37 am » in DFSORT/ICETOOL/ICEGENER - 6
- 2350
-
by sergeyken
View the latest post
Thu Nov 11, 2021 12:43 am
-
-
- 6
- 2460
-
by sergeyken
View the latest post
Thu Dec 09, 2021 8:10 pm
-
- 3
- 3730
-
by naveenkumar sudha
View the latest post
Mon May 09, 2022 10:15 pm