MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Easytrive : If input file empty

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Cool Guy
Beginner


Joined: 30 Jun 2005
Posts: 2
Topics: 1

PostPosted: Thu Jun 30, 2005 2:03 am    Post subject: Easytrive : If input file empty Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Jun 30, 2005 4:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Cool Guy
Beginner


Joined: 30 Jun 2005
Posts: 2
Topics: 1

PostPosted: Fri Jul 01, 2005 12:11 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Fri Jul 01, 2005 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group