Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easytrieve sychronized file processing

Status
Not open for further replies.

dhamspec

Programmer
Jan 29, 2002
13
0
0
CA
I have created two sumfiles and am now trying to create a report containing information combining the two. They are keyed and there are matched and unmatched records. I am currently getting ouput that is giving me only the unmatched records. I would like to get both matched and unmatched. Please see my programming below. Any help is appreciated.

IF NOT MATCHED
IF SFILE
BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
BOTH:DRAW = SFILE:STALLY
PUT BOTH
ELSE
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = HD2:STALLY2
PUT BOTH
END-IF
IF MATCHED
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
PUT BOTH
END-IF
PRINT REP3
END-IF



 
Try the below
IF NOT MATCHED
IF SFILE
BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
BOTH:DRAW = SFILE:STALLY
PUT BOTH
ELSE
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = HD2:STALLY2
PUT BOTH
END-IF
PRINT REP3
ELSE
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
PUT BOTH
PRINT REP3
END-IF

I would recommend something like this though to make it easier to follow

IF NOT MATCHED
PERFROM NOTMATCH
ELSE
PERFORM MATCH
END-IF

NOTMATCH. PROC
IF SFILE
BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
BOTH:DRAW = SFILE:STALLY
PUT BOTH
PRINT REP3
ELSE
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = HD2:STALLY2
PUT BOTH
PRINT REP3
END-IF

MATCH. PROC
BOTH:CITY = HD2:SUB-CITY-NAME
BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
PUT BOTH
PRINT REP3


-John
 
Logic error:

-IF NOT MATCHED
| -IF SFILE
| | BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
| | BOTH:DRAW = SFILE:STALLY
| | PUT BOTH
| |ELSE
| | BOTH:CITY = HD2:SUB-CITY-NAME
| | BOTH:DRAW = HD2:STALLY2
| | PUT BOTH
| -END-IF
| -IF MATCHED
| | BOTH:CITY = HD2:SUB-CITY-NAME
| | BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
| | PUT BOTH
| -END-IF
| PRINT REP3
-END-IF

Should be:

-IF NOT MATCHED
| -IF SFILE
| | BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
| | BOTH:DRAW = SFILE:STALLY
| | PUT BOTH
| |ELSE
| | BOTH:CITY = HD2:SUB-CITY-NAME
| | BOTH:DRAW = HD2:STALLY2
| | PUT BOTH
| -END-IF
-END-IF

-IF MATCHED
| BOTH:CITY = HD2:SUB-CITY-NAME
| BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
| PUT BOTH
-END-IF

PRINT REP3

Or:

-IF NOT MATCHED
| -IF SFILE
| | BOTH:CITY = SFILE:EXTR-OUT-CITY-NAME
| | BOTH:DRAW = SFILE:STALLY
| |ELSE
| | BOTH:CITY = HD2:SUB-CITY-NAME
| | BOTH:DRAW = HD2:STALLY2
| -END-IF
-END-IF

-IF MATCHED
| BOTH:CITY = HD2:SUB-CITY-NAME
| BOTH:DRAW = SFILE:STALLY + HD2:STALLY2
-END-IF

PUT BOTH
PRINT REP3


 
Hi I am new to Easytrieve.
Please help me in the below.

I have 2 files FILE1 and FILE2.
I need to do some logic like

For Each Record of FILE1
For Each Record of File3
IF ( Some Condition )
{
....
....
}

Can you please tell me how to code this in EasyTrieve.

Please let me know the Job parameters
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top