How to skip the first records



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

How to skip the first records

Postby sjrcreation » Tue Feb 22, 2011 7:21 pm

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
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to skip the first records

Postby dick scherrer » Wed Feb 23, 2011 12:49 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: How to skip the first records

Postby BillyBoyo » Wed Feb 23, 2011 6:24 am

IF RECORD-COUNT (FILE1) EQ 1
    GO TO JOB
END-IF
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to skip the first records

Postby sjrcreation » Wed Feb 23, 2011 10:38 am

Thank Deck and Billy boya.. i will try and publish the working code..
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to skip the first records

Postby BillyBoyo » Wed Feb 23, 2011 12:50 pm

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


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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to skip the first records

Postby Zio69 » Wed Feb 23, 2011 1:02 pm

Old timer question: is
RECORD-COUNT (FILE1)
a new syntax?? It used to be filename:RECORD-COUNT (I'm pretty sure of that!)
Zio69
 
Posts: 31
Joined: Wed Feb 16, 2011 7:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to skip the first records

Postby BillyBoyo » Thu Feb 24, 2011 12:30 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to skip the first records

Postby sjrcreation » Fri Feb 25, 2011 5:53 pm

Hi all, Thanks for ur repond. Zio69's code is working
so
IF file1:RECORD-COUNT NE 1
PERFORM logic1
END-IF

working :-)
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post