IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

2 input files in Easytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PRV

New User


Joined: 16 Apr 2009
Posts: 15
Location: Pune

PostPosted: Tue Apr 21, 2009 6:58 pm
Reply with quote

How to handle 2 input files in easytrieve ?

1) opening...can we open 2 files simultaneously..?
JOB INPUT FILE01
JOB INPUT FILE02
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Apr 21, 2009 7:30 pm
Reply with quote

What happened when you tried ?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 21, 2009 8:02 pm
Reply with quote

If you had checked your manual.....
CA-Easytrieve/Plus Reference Guide wrote:
During the initiation of a JOB or SORT activity, CA-Easytrieve/Plus opens all files used in the activity (except for those specified with the DEFER parameter). DEFERed files are opened when the first input/output statement is issued for them.
You do have a manual, don't you?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 21, 2009 9:52 pm
Reply with quote

Hello,

From memory - not able to test this just now. . .

You may access multiple files in the same Easytrieve execution, but you may not have 2 "JOB INPUT" processes running concurrently.

Look at the READ and GET statements.
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Tue Apr 21, 2009 11:45 pm
Reply with quote

Yes we can use multiple job statement in an Easytrieve program.Did you got any error when you tried to do this...
If you can pass on what you error/problem you encountered when tried to do this,probably can help you out in proposing solution,thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 21, 2009 11:56 pm
Reply with quote

Hello,

Quote:
Yes we can use multiple job statement in an Easytrieve program
Can they both be "active" at the same time?

Many Easytrieve modules main process "loop" begins with the JOB INPUT statement and the code issues a GO TO JOB to read the next record.

How might this work with 2 different JOB INPUT statements?
Back to top
View user's profile Send private message
titan

New User


Joined: 23 Jul 2006
Posts: 3

PostPosted: Thu Jun 18, 2009 8:38 pm
Reply with quote

You can do like this, Suppose the 2 files have same record numbers.

JOB INPUT NULL

Get FILE01
Get FILE02

Do while NOT EOF File01 and NOT EOF file02
.....
Get file01
Get file02
End-Do
STOP

icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 19, 2009 12:21 am
Reply with quote

Hello and welcome to the forum,

Yup, JOB INPUT NULL and 2 GETs will do what is needed.

We never did hear back from "raghavmcs" about the 2 JOB INPUT statements running at the same time. . .
Back to top
View user's profile Send private message
rkarthik22

New User


Joined: 18 Apr 2009
Posts: 47
Location: India

PostPosted: Fri Jun 19, 2009 6:28 pm
Reply with quote

hi d.sch,

what about this..

Quote:
There are some other parameters that can be coded on the JOB statement, such as KEY; they are explained in the manuals, the above are those I use the most.

There can be more than one JOB statement within an Easytrieve Plus program, see ESIP/PX/PXAAEP for an example - PXAAEP reads in 3 files seperately, storing the first 2 for further processing later in the code.


Quote:
Feature12: STOP and STOP EXECUTE
A STOP statement terminates an activity and goes to the next activity if additional activities are coded. A STOP EXECUTE statement immediately terminates all the Easytrieve plus execution.

Example:
(i) IF AGENTNO LT SIO-AGCY-AGENT
GET AGENTS
IF EOF AGENTS
STOP
ELSE
PERFORM PROCESS-CLIENT
END-IF
END-IF
(ii) SQL OPEN CLIENT
IF SQLCODE NE 000
STOP EXECUTE
END-IF


Explanation:
In example one, AGENTS file is read and if end of file is reached, then this particular JOB activity is stopped from execution.
In example two, the SQL statement opens the cursor called CLIENT and there is a check for SQLCODE, if it is not equal to zero then the STOP EXECUTE command terminates the Easytrieve execution as a whole.

Reason for Using:
The above features may be used depending on the severity of the error. The difference between STOP and STOP execute command exists only for an easytrieve program having multiple JOB statements.


And please comment on this:

Code:
FILE IADDRESS  FB (316 0)                   
     I-ADDRESS-ID1             1    10   P 
     I-ADDR-LINE-ONE1         13    50   A 
     I-ADDR-LINE-TWO1         65    50   A 
     I-CITY-NAME1            118    50   A 
     I-PROV-STATE-TP-CD      179   120   A 
     I-POSTAL-CODE1          292    20   A 
     I-COUNTRY-TP-CD1        315     2   A 
*                                           
FILE ISRCHNAM FB (35 0)                     
      I-CONT-ID2                1   10   P 
      I-PARTY-ID2               11  11   A 
      I-PERSON_ORG_TP2          22   1   A 
      I-ADDRESS-ID2             23  10   P 
      I-STATE_ABBR2             33   3   A 
*                                           
FILE PARMIN FB (30 0)                       
    PARMIN-REC                  1   30   A 
      PI-ADDRESS-ID             1   10   P 
      PI-COUNT                  11  10   N 
      PI-MAX-COUNT              21  10   N 
*                                           
FILE PARMOUT  FB (30 0)                     
    PARMOUT-REC                 1   30   A 
      PO-ADDRESS-ID             1   10   P 
      PO-COUNT                  11  10   N 
      PO-MAX-COUNT              21  10   N           
*                                                   
FILE OADDRESS  FB (327 0)                           
     O-ADDRESS-ID1              1   10   P           
     O-ADDR-LINE-ONE1          11   50   A           
     O-ADDR-LINE-TWO1          61   50   A           
     O-CITY-NAME1             111   50   A           
     O-PROV-STATE-TP-CD       161  120   A           
     O-POSTAL-CODE1           281   20   A           
     O-COUNTRY-TP-CD1         301    2   A           
     O-CONT-ID1               303   10   P           
     O-PARTY-ID1              313   11   A           
     O-STATE_ABBR1            324    3   A           
     O-PERSON_ORG_TP1         327    1   A           
*                                                   
FILE OPURGFIL FB(10 0)                               
     O-ADDRESS-ID2             1   10   P           
*                                                   
*****************************************************
* WS SECTION                           
*****************************************************
WS-ADDRESS-ID                  W   10   P           
WS-ADDRESS-ID1                 W   10   P           
WS-COUNT                       W   10   N           
WS-PARMOUT-REC                 W   30   A           
  WS-PARMOUT-ADDRESS WS-PARMOUT-REC     10   P       
  WS-PARMOUT-COUNT   WS-PARMOUT-REC +10 10   N       
  WS-PARMOUT-MAX-COUNT   WS-PARMOUT-REC +20 10   N   
****************************************************************
* END OF WS SECTION                               
****************************************************************
*                                                               
JOB INPUT PARMIN                                               
 WS-PARMOUT-ADDRESS = 0                                         
 WS-PARMOUT-COUNT = 0                                           
 WS-ADDRESS-ID = PI-ADDRESS-ID                                 
 WS-COUNT      = PI-COUNT                                       
 WS-PARMOUT-MAX-COUNT = PI-MAX-COUNT                           
*                                                               
JOB INPUT ( IADDRESS KEY (I-ADDRESS-ID1)  +                     
            ISRCHNAM KEY (I-ADDRESS-ID2)) +                     
           FINISH (FINAL-PROC)                                 
         IF WS-COUNT LT WS-PARMOUT-MAX-COUNT                   
            IF MATCHED AND (I-ADDRESS-ID1 GT WS-ADDRESS-ID)     
               IF NOT DUPLICATE ISRCHNAM OR LAST-DUP ISRCHNAM   
                  WS-COUNT =  WS-COUNT + 1                     
               END-IF                                           
               WS-ADDRESS-ID1       =  I-ADDRESS-ID1           
               O-ADDRESS-ID1        =  I-ADDRESS-ID1           
               O-COUNTRY-TP-CD1     =  I-COUNTRY-TP-CD1         
               O-ADDR-LINE-ONE1     =  I-ADDR-LINE-ONE1         
               O-ADDR-LINE-TWO1     =  I-ADDR-LINE-TWO1         
               O-CITY-NAME1         =  I-CITY-NAME1             
               O-PROV-STATE-TP-CD   =  I-PROV-STATE-TP-CD       
               O-POSTAL-CODE1       =  I-POSTAL-CODE1           
               IF I-CONT-ID2 NOT NUMERIC                       
                 MOVE ZEROS        TO O-CONT-ID1             
              ELSE                                           
                 O-CONT-ID1        =  I-CONT-ID2             
              END-IF                                         
              O-PARTY-ID1          =  I-PARTY-ID2             
              O-STATE_ABBR1        =  I-STATE_ABBR2           
              O-PERSON_ORG_TP1     =  I-PERSON_ORG_TP2       
              PUT OADDRESS                                   
           ELSE                                               
              IF IADDRESS AND (I-ADDRESS-ID1 GT WS-ADDRESS-ID)
                 WS-COUNT = WS-COUNT + 1                     
                 WS-ADDRESS-ID1    =  I-ADDRESS-ID1           
                 O-ADDRESS-ID2     =  I-ADDRESS-ID1           
                 PUT OPURGFIL                                 
              END-IF                                         
           END-IF                                             
        ELSE                                                 
           IF I-ADDRESS-ID1 GT WS-ADDRESS-ID1                 
              IF NOT EOF IADDRESS                             
                 WS-PARMOUT-ADDRESS = I-ADDRESS-ID1           
                 WS-PARMOUT-COUNT   = 0                       
              ELSE                                           
                 WS-PARMOUT-ADDRESS = 0                       
                 WS-PARMOUT-COUNT   = 0                       
              END-IF                                         
              STOP                                           
           END-IF                                             
        END-IF                                               
*             
Back to top
View user's profile Send private message
rkarthik22

New User


Joined: 18 Apr 2009
Posts: 47
Location: India

PostPosted: Fri Jun 19, 2009 6:35 pm
Reply with quote

Please dont ask the function of this our old prod EZT icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 20, 2009 5:45 am
Reply with quote

Hello,

In the 2 quotes above that mention "multiple JOB statements", there is NO mention (or even an implication) that these may be "in process" at the same time.

The posted code looks rather typical and uses the Easytrieve built-in function to match 2 files on "the key". While there are 2 JOB statements, they are not inter-leaved. The parm is read and that is the only reference to the input parameter data (and the only time the first JOB statement is executed). The second JOB statement begins the processing loop that reads/matches the 2 input files and writes an updated file.

I suggest you make up some small volume files for the 2 input files and run a test so you can see exactly how this code works.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top