READ WORK FILE

Hi

When I am reading a dataset through READ WORK FILE. I would like check wether if the file is empty or not. How can do this. If it is Natural read statement I can check through *NUMBER. Please help me in this regard.

TIA.

Subba

You’re right. *NUMBER or *COUNTER is not filled. AFAIK you have to count on your own…

READ WORK FILE 1 #a30
add 1 to #counter
END-WORK
READ WORK 1 ONCE RECORD field list
  AT END OF FILE
    WRITE 'Work file 1 is empty; header record not found'
    STOP
  END-ENDFILE
process header record
/*
READ WORK 1 RECORD field list
  process detail record
END-WORK