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

26 thoughts on “Easytrieve – Report creation sample”

  1. 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

  2. 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
    *

  3. 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.

  4. 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.

  5. 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

  6. 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

  7. 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.

  8. 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.

  9. 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 —
    /*

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

  11. 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.

  12. You can use the search box at the top to find get,put,read,write programs.
    https://littlecode.in/2010/09/20/get-and-put-statements-in-easytrieve/
    https://littlecode.in/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.

  13. 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.

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

    Thanks in Advance .

  15. 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.

  16. 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

  17. 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.

  18. 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

  19. 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.

  20. 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

  21. 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

  22. 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

  23. 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.

  24. 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.