View previous topic :: View next topic |
Author |
Message |
Cool Guy Beginner
Joined: 30 Jun 2005 Posts: 2 Topics: 1
|
Posted: Thu Jun 30, 2005 2:03 am Post subject: Easytrive : If input file empty |
|
|
Hi All,
Help me guys!!! I am new to Easytrive.
I have a requirement where in if the input file is empty still I need to
write something to the output report file which the end user does not want to be empty.
So what I did was checked if it is end of file after reading , if not then I am doint the regular processing and in the else part I am just having a STOP statement ( i even tried STOP EXECUTE). I was expecting it will go to TERMINATION PROC and write the display which I have for displaying the number of records read. But the program gets over successfully but my output file is still empty.
Please guide me what am i doing wrong , or is there any other way to do it.
Thanks
Cool Guy |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Jun 30, 2005 4:49 am Post subject: |
|
|
Cool Guy,
You can use FINISH parm on your Job statement or check the RECORD-COUNT parm and write to the output file.
OR
Code: |
JOB INPUT INFILE FINISH DISP-PROC
your pgm logic
...
DISP-PROC. PROC
IF INFILE:RECORD-COUNT = 0
OUTPUT-RECORD = 'EMPTY INPUT FILE'
PUT OUTPUT
END-IF
END-PROC
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Cool Guy Beginner
Joined: 30 Jun 2005 Posts: 2 Topics: 1
|
Posted: Fri Jul 01, 2005 12:11 am Post subject: |
|
|
Hi Kolusu,
I tried the following but in no vain.
Code: | JOB INPUT INFILE FINISH FINISH-PROC
W-PPE = I-PPE
W-RETRO-EFF-DT = I-RET-EFF-DT
W-RETRO-EXP-DT = I-RET-EXP-DT
W-COMPANY = I-COMP
W-PAYGRP = I-PAY-GRP
W-PROJ = I-PRJ-NBR
RECS-READ = RECS-READ + 1
PRINT RETRO-RPT
*
FINISH-PROC. PROC
IF INFILE:RECORD-COUNT = 0
DISPLAY 'RECORDS READ' RECS-READ
STOP
END-IF
END-PROC
*
REPORT RETRO-RPT PRINTER RPTFILE PAGESIZE 65 LINESIZE 132 +
SKIP 1 NOSPREAD NODATE SUMCTL TAG NOADJUST
SEQUENCE I-SM I-COMP I-PAY-GRP
TERMINATION. PROC
DISPLAY ' '
DISPLAY 'NUMBER OF RECORDS REPORTED: ' RECS-READ
END-PROC
BEFORE-BREAK. PROC
IF I-SM BREAK
DISPLAY ' EMPLOYEE TOTAL :' I-RET-AMT
ELSE-IF FINAL HIGHEST-BREAK
I-OLD-RATE = 0
I-NEW-RATE = 0
I-HRS = 0
END-IF
END-PROC |
I had given a STOP in FINISH-PROC so that finally the TERMINATION PROC will be invoked and the output file will have something .But still the file is empty.
Please help / suggest some other way of doing it.
Cheers
Cool Guy |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Fri Jul 01, 2005 5:09 am Post subject: |
|
|
coolguy,
Your Finish Logic should have printed a line in your report. Are you sending the report to sysprint ? If so check your sysprint for the display of the message. It WILL be displayed. btw how is RPTFILE defined?
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|