View previous topic :: View next topic |
Author |
Message |
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Wed Jun 08, 2005 12:41 pm Post subject: Easytrieve Detail Line on Report |
|
|
Hello there,
Is there a way to print the line-number on the detail line of the report
Example
DATA : aaabbbcccddd
eeefffggghhh
iiijjjkkklll
REPORT :
01 aaa bbb ccc ddd
02 eee fff ggg hhh
03 iii jjj kkk lll
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jun 08, 2005 12:55 pm Post subject: |
|
|
Turbo,
Decalre a working-storage variable as below
Code: |
W-LINE-NUM S 09 N 0 VALUE 0
JOB INPUT FILEIN
W-LINE-NUM = W-LINE-NUM + 1
PRINT RPT
|
And use that field in the LINE statement
Code: |
LINE W-LINE-NUM FIELD-1 FIELD-2 FIELD-3 FIELD-4
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jun 08, 2005 1:05 pm Post subject: |
|
|
Turbo,
On second thoughts , you don't need the variable , you can use system defined field RECORD-COUNT which ia a read-only four-byte binary field that contains the number of logical I/O operations performed to the file.
So change your line stmt to the the following.
Code: |
LINE FILEIN:RECORD-COUNT FIELD-1 FIELD-2 FIELD-3 FIELD-4
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Wed Jun 08, 2005 1:15 pm Post subject: |
|
|
Thanks for the quick reply Kolusu.
Yes i tried those options. I should have been more clear.
I do a sequence and a control for the report.
The line number should intialize itself to 1 after the break. I am not able to acheive this by the above method
Turbo |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jun 08, 2005 1:35 pm Post subject: |
|
|
Turbo,
you can reset the seqnum using the ENDPAGE report feature.code it after your report statement.
Code: |
ENDPAGE. PROC
W-LINE-NUM = 1
END-PROC
|
Another alternative is manually ressetting the seqnum. The default no: of lines per page in easytrieve reports is 58(inclusive of headers) lines. Once you cross that you will have a page break and the report will be printed on the next page.
So you can code a logic to count the line numbers and reset the seqnum.
Code: |
IF W-LINE-NUM > 56
W-LINE-NUM = 1
ELSE
W-LINE-NUM = W-LINE-NUM + 1
END-IF
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Wed Jun 08, 2005 1:49 pm Post subject: |
|
|
Kolusu,
The above will not work as i have already tried it.
There is a line-number keyword. I was not able to find out how i can use it.
To be more precise my report should look this way
01 aaa aaa aaa
02 bbb bbb bbb
03 ccc ccc ccc
BREAK
01 ddd ddd ddd
02 eee eee eee
03 fff fff fff
BREAK
01 ggg ggg ggg
BREAK
01 hhh hhh hhh
02 iii iii iii
This every thing appears on one page. So, i cannot use END-PAGE PROC for it.
Thanks,
Turbo |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jun 08, 2005 2:00 pm Post subject: |
|
|
Quote: |
The above will not work as i have already tried it.
|
Turbo,
Please post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
First you said you wanted to seqnum and later you added re-setting of the seqnum on page break.
You need to clear with your requirements. From your latest requirement , I guess that you have a control on one of the field. So after a break you need to reset the seqnum , is that right?
If that is the case you case you can use AFTER-BREAK proc.
Code: |
AFTER-BREAK. PROC
W-LINE-NUM = 1
END-PROC
|
Quote: |
There is a line-number keyword. I was not able to find out how i can use it.
|
The line-number is a reserved word and cannot be used.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Wed Jun 08, 2005 2:22 pm Post subject: |
|
|
Code: |
LINE-CNT DEPT SECTION
010 011 00162 record 1
018 record 2
024 record 3
017 record 4
044 record 5
016 record 6
Break Here
001 011 06565 record 1
037 record 2
058 record 3
Break Here
001 011 06646 record 1
013 record 2
|
The above is the report i get when tried After-break proc
The line-cnt is the total number of records processed. It is being populated in the job statement itself as you coded above.
But what i want the report to look like is
Code: |
LINE-CNT DEPT SECTION
001 011 00162 record 1
002 record 2
003 record 3
004 record 4
005 record 5
006 record 6
Break Here
001 011 06565 record 1
002 record 2
003 record 3
Break Here
001 011 06646 record 1
002 record 2
|
Sorry for the confusion and hope i am clear this time.
Thanks,
Turbo |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jun 08, 2005 2:56 pm Post subject: |
|
|
Quote: |
Sorry for the confusion and hope i am clear this time.
|
Turbo,
Nope not clear. you need to remember that we are communicating via internet and I can't really read understand your requirements over the net. I have asked you a question in my prior post which is
Code: |
I guess that you have a control on one of the field. So after a break you need to reset the seqnum , is that right?
|
You did not even bother to answer the question, but came back with a sample data.
From the sample report I can ONLY GUESS that you have control break on DEPT and SECTION. is that right?
If that is the case you can still use the AFTER-BREAK proc but you need to specify the level
ex:
Code: |
AFTER-BREAK. PROC
IF BREAK-LEVEL = 2
W-LINE-NUM = 1
END-IF
END-PROC
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Thu Jun 09, 2005 8:46 am Post subject: |
|
|
Kolusu,
Yes there is a break on Dept and Section. I put in the sample data to illustrate the breaks.
Even if the LEVEL is used it is not solving the purpose as sequence number is already populated in the beginning and it will not increment as intended after the break as coded below.
W-LINE-NUM S 09 N 0 VALUE 0
JOB INPUT FILEIN
W-LINE-NUM = W-LINE-NUM + 1
PRINT RPT
In the sample data in my previous post, it is the output from a run. As you can see only the first record sequence number gets initialized to 1 and the remaining records have the sequence number from the code in JOB, after the BREAK.
I do not think there is a way to put in the sequence number in each BREAK. Let me know if any thing comes up.
Thanks for your assistance.
Turbo |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Jun 09, 2005 9:10 am Post subject: |
|
|
Turbo,
I tried to mimic your data and generate the report. check this
Code: |
//STEP0100 EXEC PGM=EZTPA00
//EZTVFM DD UNIT=SYSDA,SPACE=(CYL,(250,125),RLSE)
//STEPLIB DD DSN=EASYTREV.LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//FILEIN DD *
011 00162 RECORD1
011 00162 RECORD2
011 00162 RECORD3
011 00162 RECORD4
011 00162 RECORD5
011 00162 RECORD6
011 06565 RECORD1
011 06565 RECORD2
011 06565 RECORD3
011 06565 RECORD4
011 06565 RECORD5
011 06646 RECORD1
011 06646 RECORD1
012 00162 RECORD1
012 00162 RECORD2
012 00162 RECORD3
012 00162 RECORD4
012 00162 RECORD5
012 00162 RECORD6
012 06565 RECORD1
012 06565 RECORD2
012 06565 RECORD3
012 06565 RECORD4
012 06565 RECORD5
012 06646 RECORD1
012 06646 RECORD1
//DETRPT DD SYSOUT=*
//SYSIN DD *
FILE FILEIN
DEPT 001 03 A
SECTION 009 05 A
FIELD-3 016 10 A
FILE DETRPT PRINTER
W-LINE-NUM S 09 N 0 VALUE 0
JOB INPUT FILEIN
W-LINE-NUM = W-LINE-NUM + 1
PRINT DETRPT
REPORT DETRPT LINESIZE 81 PAGESIZE 60 NOADJUST +
PRINTER DETRPT
CONTROL FINAL NOPRINT DEPT SECTION
LINE W-LINE-NUM DEPT SECTION FIELD-3
AFTER-BREAK. PROC
IF LEVEL = 1
IF BREAK-LEVEL = 1
W-LINE-NUM = 1
END-IF
ELSE-IF LEVEL = 2
W-LINE-NUM = 1
END-IF
END-PROC
/*
|
The output from this job is
Code: |
W-LINE-NUM DEPT SECTION FIELD-3
1 011 00162 RECORD1
2 RECORD2
3 RECORD3
4 RECORD4
5 RECORD5
6 RECORD6
011 00162
1 011 06565 RECORD1
2 RECORD2
3 RECORD3
4 RECORD4
5 RECORD5
011 06565
1 011 06646 RECORD1
2 RECORD1
011 06646
011
1 012 00162 RECORD1
2 RECORD2
3 RECORD3
4 RECORD4
5 RECORD5
6 RECORD6
012 00162
1 012 06565 RECORD1
2 RECORD2
3 RECORD3
4 RECORD4
5 RECORD5
012 06565
1 012 06646 RECORD1
2 RECORD1
012 06646
012
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Turbo Beginner
Joined: 08 Jun 2005 Posts: 6 Topics: 1
|
Posted: Thu Jun 09, 2005 11:48 am Post subject: |
|
|
Yes, the above solution works only when the data is already sorted. The sequence statement in the report will not do it right.
I figured that out and was able to get the report right.
If you want to try change the sequence of the data in the FILEIN and use a SEQUENCE statement in the REPORT. WS-LINE-NUM will not be what it appears right now in the output above.
Thanks,
Turbo |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Jun 09, 2005 1:06 pm Post subject: |
|
|
Quote: |
Yes, the above solution works only when the data is already sorted. The sequence statement in the report will not do it right
|
Turbo,
A sorted data always run faster than using sequence. If you can run a sort step prior to the easytrieve pgm or you can even sort in the pgm itself
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|