Loading

Easytrieve – Report creation sample

In most of the shops, Easytrieve is used for creating reports; and, Easytrieve has more customizable options for reporting.

Detailed reports:
Below is example 1. The output report file must be defined as FB 133 in the JCL.

In the below example, the input file INMAST contains below data

0001
0002
0003
0004
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 LIST ON
 FILE INMAST FB 4
   IN-NUM 1 4 N
 FILE OUTFILE PRINTER
 JOB INPUT INMAST
    PRINT TEMP-REPT
 END-JOB
*
 REPORT TEMP-REPT PRINTER OUTFILE
 TITLE 1 'ANNUAL REPORT'
 LINE  IN-NUM
*

Output will look like

106/02/12            ANNUAL REPORT         PAGE 1
-                       0001
0                       0002
                        0003
                        0004

Example 2:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 LIST ON
 FILE INMAST FB 4
   IN-NUM 1 4 N HEADING ('ACCOUNT' 'NUMBER')
 FILE OUTFILE PRINTER
 JOB INPUT INMAST
    PRINT TEMP-REPT
 END-JOB
*
 REPORT TEMP-REPT PRINTER OUTFILE PAGESIZE 50 +
 NOSPREAD NOADJUST NODATE NOPAGE
 TITLE 1 'ANNUAL REPORT'
 LINE  IN-NUM
*

Output will look like

1ANNUAL REPORT
-
 ACCOUNT
 NUMBER
0 0001
  0002
  0003
  0004

Summary reports:
Example 3:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 LIST ON
 FILE OUTFILE1 PRINTER
*
 WS-VAL1 W 2 A VALUE 'V1'
 WS-VAL2 W 2 A VALUE 'V2'
 WS-VAL3 W 2 A VALUE 'V3'
*
 JOB INPUT NULL
 PRINT SAMPLE1
 STOP
 REPORT SAMPLE1 PRINTER OUTFILE1 PAGESIZE 55 LINESIZE 80 -
 NODATE NOPAGE NOADJUST NOSPREAD NOHEADING
 TITLE 01 COL 01 'HEADING ' -
          COL 30 'VALUES '
 LINE 01 COL 10 'VAL 1 IS ' -
         COL 30 WS-VAL1
 LINE 02 COL 10 'VAL 2 IS ' -
         COL 30 WS-VAL2
 LINE 03 COL 10 'VAL 2 IS ' -
         COL 30 WS-VAL3

Related Posts




blog comments powered by Disqus

There's 26 Comments So Far

  •   kiranmayi
    March 29th, 2012 at 1:23 pm

    Hie karthik

    If i want to include more no.of fields for example

    line 01 emp-id emp-name emp-salary emp-dept emp-designation emp-grade

    it is saying those fields should be within procedure.

    Is there any other options to write more number of records in a report

  •   Karthik
    March 30th, 2012 at 4:13 am

    Kiranmayi, that should work. Did you try something like below? Did you use the continuation character ‘+’ / ‘-‘ (if you split a statment across multiple lines).

    LIST ON
    FILE INMAST FB 80
    EMP-ID 1 6 N HEADING (‘EMP-ID’)
    EMP-NAME 8 10 A HEADING (‘NAME’)
    EMP-SALARY 22 5 N HEADING (‘SALARY’)
    EMP-DEPT 28 10 A HEADING (‘DEPT’)
    EMP-DESIGNATION 39 10 A HEADING (‘DESIG’)
    EMP-GRADE 50 2 A HEADING (‘GR’)
    FILE OUTFILE PRINTER
    JOB INPUT INMAST
    PRINT TEMP-REPT
    END-JOB
    *
    REPORT TEMP-REPT PRINTER OUTFILE PAGESIZE 50 +
    NOSPREAD NOADJUST NODATE NOPAGE
    TITLE 1 ‘–EMP REPORT–‘
    LINE EMP-ID ‘,’ EMP-NAME ‘,’ +
    EMP-SALARY ‘,’ EMP-DEPT ‘,’ +
    EMP-DESIGNATION ‘,’ EMP-GRADE
    *

  •   kiranmayi
    March 30th, 2012 at 5:26 am

    yeah it is working i have tried the same way yesterday after posting you.

    the thing is i come to know that we cant do a report beyond linesize 80 right? actually my input file contains 600+ linesize data.

  •   Karthik
    March 30th, 2012 at 6:22 am

    the reports can have a max of 133 bytes length. If you want some report like file with more than 133 record length, you need to write it like a normal file – with the addition of manually formatting the data, handling paging and title.

  •   mattias
    September 9th, 2012 at 7:38 am

    Hi

    I am doing a report with a summary. Can you sort the summary in descending order on the summed field?

    Is there a function for limit the output to display only ten lines?

    Br
    Mattias

  •   Sarath
    October 1st, 2012 at 3:18 pm

    Hi,

    In my easytrieve report, TITLE is a working storage variable which is defined as below.
    WS-TYPE W 60 A
    …….
    ……
    TITLE 1 WS-TYPE

    Different values get populated in this field based on some criteria. Each of this values have different lenghs. So whenever I print this Report, TITLE is getting aligned based on the defined length of WS-TYPE. i.e. 60. I want this TITLE to be aligned based on the lenth of the value in that working storage variable (WS-TYPE).

    Is there anyway I can achieve this ?

    Thanks in advance,
    Sarath

  •   Karthik
    October 6th, 2012 at 12:00 pm

    Hi Sarath,

    Sorry for late response.

    You can use Varying Length Fields.

    DEFINE WS-TYPE W 60 A VARYING

    this will automatically trim spaces at the right.

    You can read WS-TYPE:LENGTH to see what is the length of the variable at any point of time.

  •   priya
    April 20th, 2013 at 4:12 am

    hi karthik,
    i’m beggginer in easytrieve.can u provide me some simple example for reprt creation with heading,title.which should run trough a jcl.can u provide me full example with jcl too..thankx in advance.

  •   Karthik
    April 21st, 2013 at 9:51 am

    JCL step should look like,

    //STEP01 EXEC PGM=EZTPA00
    //input DD DSN=MY.INPUT.FILE,DISP=SHR
    //report DD DSN=MY.REPORT.FILE,
    // DISP=(NEW,CATLG,DELETE),
    // SPACE=(CYL,(100,50),RLSE),
    // DCB=(RECFM=FB,LRECL=133,BLKSIZE=0)
    //SYSOUT DD SYSOUT=*
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD *
    — Easytrieve Code here —
    /*

  •   priya
    April 23rd, 2013 at 7:43 am

    thanx.can u give some more examples of read and write,statements full easttrieve code with jcl and synchronized file too.

  •   priya
    April 23rd, 2013 at 10:12 am

    what is the use of *(astriek) in easytrieve code.why we are using that.

  •   Karthik
    April 23rd, 2013 at 10:46 am

    Easytrieve synchronized files:
    http://code.xmlgadgets.com/2009/10/08/easytrieve-synchronized-files/

    Usage of asterisk *
    1) for commenting http://code.xmlgadgets.com/2012/03/20/comments-in-easytrieve-start-with/
    2) file variable declaration http://code.xmlgadgets.com/2009/10/08/easytrieve-file-handling/

  •   priya
    April 23rd, 2013 at 3:24 pm

    thank u so much..it is helpful karthik.do you have any sample program for get,put,read,write ,point and display altogether coded in single program.kindly update me simple and easy to understand,if possible with jcl too.

  •   Karthik
    April 24th, 2013 at 8:47 am

    You can use the search box at the top to find get,put,read,write programs.
    http://code.xmlgadgets.com/2010/09/20/get-and-put-statements-in-easytrieve/
    http://code.xmlgadgets.com/2010/09/20/read-and-write-statement-in-easytrieve/

    The JCL will be similar fo all the Easytrieve programs. Only the DD statements will differ based on your requirement.
    I am feeling that providing the full program is like spoon-feeding (but helps when we are in a hurry). Giving the code along with JCL for every possible scenario will be difficult for me.

  •   priya
    April 24th, 2013 at 12:15 pm

    thanks..m in hurry only asked.report i creted.get and put.read and write m nt getting.since m beginner its diffcult for me.

  •   Ajay Rai
    May 6th, 2013 at 7:34 am

    Hi Karthik,
    Can u please explain the printer statement in easytrieve with codes and with some examples .

    Thanks in Advance .

  •   Karthik
    May 8th, 2013 at 10:37 am

    The PRINTER option indicates print output files. Although input/output statements (GET, PUT, READ, WRITE) cannot reference these printer files, the DISPLAY statement and REPORT statements can reference them. Unless otherwise coded, record length and blocksize default to one more than the LINESIZ entry in the Options Table. The additional character contains the ASA control character.

    No fields can be defined for a PRINTER file. When coded for a file that specifies the HOSTDISK keyword, PRINTER must be specified before HOSTDISK and PRN is the only valid value for the HOSTDISK subparameter FORMAT.

  •   Lakshmy
    June 3rd, 2013 at 5:29 am

    Hi Karthik,

    I am creating a report and it has the below columns,
    id,name,dept and in case if Id has 2 rows then I want to display the report in the below way.
    Input
    id Name Dept
    1 X HR
    1 Y Admin
    Output
    Id Name dept
    1 X HR
    Y Admin

    Please do the needful

  •   Karthik
    June 3rd, 2013 at 9:54 am

    Lakshmy,

    Do you want me to write the program for you?
    You will have to do it yourself. I can help if you have any specific question.

  •   Lakshmy
    June 5th, 2013 at 7:28 am

    Sorry Karthik.I have written the program however I am not sure how to combine the rows.For example in the above requirment ID is common for both the rows so I want to display it only once.Is there any command in easytrieve so that I can group the rows using a column.

    Thanks,
    Lakshmy

  •   Karthik
    June 5th, 2013 at 7:58 am

    First, sort your input file on the ID.
    While writing to report, if the ID for a particular record is same as the ID in the previous record, populate it as spaces.

  •   Lakshmy
    June 12th, 2013 at 4:55 am

    Hi Karthik,

    I tried doing the above method however it is showing an error message as “invalid file reference” as it is a ps file.

    Can you please let me know if there is any keyword that I can use so that when duplicate values are in the columns only the first one will be displayed.

    Thanks,
    Lakshmy

  •   Lakshmy
    June 12th, 2013 at 4:58 am

    Hi Karthik,

    I have tried using the above method however the programs is ending with invalid file reference error.

    Please let me know if there is any keyword I can use with that column name so that if duplicates are there then only the first value will be displayed and the next ones will be blank.

    Thanks,

    Lakshmy

  •   Ignatius
    August 12th, 2013 at 8:54 am

    Karthick,

    I have created a tdr report for 2d axis system. I have called it in the vbs script but I am not able to load the channels automatically in to the report instead of drag ana drop option. Explain how to access the channels automatically in to the report file without using drag and drop option for the customized report.

    Thanks,
    X. Ignatius

  •   Nitin
    December 12th, 2013 at 7:36 am

    I do not want the tile(report header) appearing on each new page. It should be only one at the top. Which statement I should use.

  •   Ravi
    December 13th, 2013 at 4:56 pm

    Hi Karthik,

    How to specify font , color options in easytrieve, i have a o/p file which shud contain jobs completed as well as not completed for a particular day.

    I am sending that file as an email, now in email i need the font as blue for jobs completed and red for jobs not completed.

    Could you please suggest me or provide some example where html tags used in easytrieve

Share your thoughts, leave a comment!