View previous topic :: View next topic
|
Author |
Message |
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
Hi,
I have an Easytrieve code wherein the report is going to the SYSPRINT.
LIST ON
*
**** INPUT FILE
*
FILE IN1
IN1-REC 1 76 A
IN1-OLD-BBB 1 29 A
IN1-OLD-MMM 30 09 N
IN1-NEW-BBB 39 29 A
IN1-NEW-MMM 68 09 N
*
**** SELECT QUERY
*
FILE IN2
IN2-REC 1 133 A
IN2-OLD-MMM 1 09 N
IN2-CCC-NO 10 09 N
*
**** OUTPUT FILE
*
FILE OUT1
OUT1-REC 1 28 A
* OUT1-OLD-MMM 1 09 N
* OUT1-NEW-MMM 10 09 N
* OUT1-CCC-NO 19 10 N
WS-OLD-MMM W 09 N VALUE 0
WS-NEW-MMM W 09 N VALUE 0
JOB INPUT NULL
* DISPLAY 'INSIDE'
IF EOF IN1
STOP
ELSE
GET IN1
END-IF
IF EOF IN2
STOP
ELSE
GET IN2
END-IF
IF IN1-OLD-MMM = IN2-OLD-MMM
* DISPLAY 'IN1-OLD-MMM' IN1-OLD-MMM
* DISPLAY 'IN2-OLD-MMM' IN2-OLD-MMM
PRINT OUT1
GET IN1
GET IN2
* GO TO JOB
ELSE
IF IN1-OLD-MMM > IN2-OLD-MMM
* DISPLAY 'IN1-OLD-MMM' IN1-OLD-MMM
* DISPLAY 'IN2-OLD-MMM' IN2-OLD-MMM
GET IN2
IF EOF IN2
STOP
ELSE
GET IN1
END-IF
* GO TO JOB
ELSE
* DISPLAY 'IN2-OLD-MMM' IN1-OLD-MMM
* DISPLAY 'IN2-OLD-MMM' IN1-NEW-MMM
GET IN1
IF EOF IN1
STOP
END-IF
* GO TO JOB
END-IF
END-IF
REPORT OUT1 LINESIZE 80 SUMMARY SPREAD
SEQUENCE IN2-OLD-MMM
CONTROL IN2-OLD-MMM
LINE IN2-OLD-MMM WS-NEW-MMM
*START-PROC. PROC
* GET IN1
* GET IN2
*END-PROC
I want the report to go to OUTPUT file.
Kindly advise. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Look up SUMFILE in the manual. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Or use PRINTER for your FILE OUT1, and to expand on Bill Woodger's comment read the fine manual. |
|
Back to top |
|
|
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
I used as below,
FILE OUT1 PRINTER
Report is going to SYSPRINT.
Also for using SUMFILE, I had to remove PRINTER from FILE description.
WHEN I used SUMFILE,
the values of IN2-OLD-MMM and WS-NEW-MMM come in the output file.
They are not in the report format.
Please let me know how to get the report in SYSPRINT to output file.
The SYSPRINT report is as below,
1 4/28/11 REPORT1 PAGE 1
-
IN2-OLD-MMM WS-NEW-MMM
0 111111111
Thanks in advance. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
//OUT1 DD your printfile dataset
FILE OUT1 PRINTER FB(133 6118)
REPORT OUT1 PRINTER OUT1 LINESIZE 132 SUMMARY SPREAD
SEQUENCE IN2-OLD-MMM
CONTROL IN2-OLD-MMM
LINE IN2-OLD-MMM WS-NEW-MMM |
|
Back to top |
|
|
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
Thanks a Ton!!!! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Elixir,
I think you have problems with your code. I have "tarted it up" to make it easier to follow.
In the first part of the flow, you read (GET) records from both files.
If you then find a match, you do your stuff, read records from both files, then go to the first part of the flow again. Where you immediately read records from both files. Similar with the other reads in the conditional logic. You are skipping records.
Easytrieve Plus has built-in file matching logic. You might want to look this up and apply it.
Also, presumably your files are sequenced on IN1-OLD-MMM/IN2-OLD-MMM? Therefore, there is no reason to SEQUENCE the report. If already in that order, then why sort it again?
The default column headings for IN2-OLD-MMM and WS-NEW-MMM (or any data-name on a report line) is the data-name itself. That is why you had them on the output. Column headings. If you don't want them, look at the REPORT statement and its options in the manual.
You don't ever put anything in WS-NEW-MMM.
Elixir wrote: |
JOB INPUT NULL
IF EOF IN1
STOP
ELSE
GET IN1
END-IF
IF EOF IN2
STOP
ELSE
GET IN2
END-IF
IF IN1-OLD-MMM = IN2-OLD-MMM
PRINT OUT1
GET IN1
GET IN2
ELSE
IF IN1-OLD-MMM > IN2-OLD-MMM
GET IN2
IF EOF IN2
STOP
ELSE
GET IN1
END-IF
ELSE
GET IN1
IF EOF IN1
STOP
END-IF
END-IF
END-IF
REPORT OUT1 LINESIZE 80 SUMMARY SPREAD
SEQUENCE IN2-OLD-MMM
CONTROL IN2-OLD-MMM
LINE IN2-OLD-MMM WS-NEW-MMM
|
|
|
Back to top |
|
|
|