0

I have a requirement to generate an Excel report using P4QFOCUS. If the input file has data, then print the data in excel sheet, If there is no record in input file,then print only message "file is empty" in excel sheet.

Eg:

input file:
01 james 25
05 john  18

If input file has records then,Excel sheet should be generated as below,

RollNo  Name   Age
01      james  25
05      john   18

If no records are present in input file then, excel sheet should be generated as, "file is empty"

I am expecting the logic for Focus step, if focus step is ready,then i will have a mail step to send the report to the mail id as an excel format.

Please find the code below, which i have tried.

TABLE FILE <Table name>                          
COUNT <Roll No> NOPRINT                
IF COUNT NE 0                                
PRINT Roll-No  AS  'Roll No'  
      Name     AS  'NAME'
      Age      AS  'Age'
ELSE
IF COUNT EQ 0  
PRINT          
 HEADING CENTER
  "File is empty"
  • So what part do you have a problem with? Please update your tags: focus is not what you think, and this is nothing to do with jcl. There is very little FOCUS around in the world, why do you have to do it with FOCUS? – Bill Woodger Mar 02 '16 at 09:00
  • I have coded the Focus, and its working fine. but now i am getting empty excel sheet, when the input file is empty. But i want to print an error message: "file is empty" instead of empty excel sheet. If anyone had the same requirement, please let me know the syntax to handle my requirment. – Prayag KL-13 Mar 02 '16 at 09:20
  • Can you establish a count (or use an existing one if it is built-in to FOCUS) which reflects the number of records written? Then at the end of the processing you test that for zero, and output your message? – Bill Woodger Mar 02 '16 at 11:09
  • Yeah, There is a function count. I have tried the same logic.(Please see the code above on my question) but i guess the syntax is wrong, i have reffered few Focus manuals, but didnt get the exact code(syntax) – Prayag KL-13 Mar 02 '16 at 12:29
  • Have you got *FOCUS for Mainframe Creating Reports*. You need to read through that. Look at what COUNT does (you can't use it how you have shown) and look at the documentation of empty reports, ON, WHEN and perhaps you'll get somewhere. – Bill Woodger Mar 02 '16 at 13:03

0 Answers0