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

Handling Multiple Files in Easytrieve


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

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Oct 16, 2008 9:06 am
Reply with quote

Hi,

We have 1 reference file and 4 other files. We have to compare each of these 4 files with the reference file on the same field. Can we declare more than 2 files in JOB activity and compare in a single easytrieve program as shown below?

Below is the JOB activity:
Code:

JOB INPUT (FLSBRNCH KEY (WS-KEY)   +
           INFODLY  KEY (WS-KEY1)  +
           MSTDLY   KEY (WS-KEY2)  +
           PRMNBR   KEY (WS-KEY3)  +
           RELHST   KEY (WS-KEY4))   


Below is the comparison code:

Code:

IF WS-KEY = WS-KEY1             
    MOVE WS-FC-NBR TO PRI-FA-KEY
END-IF.                         

IF WS-KEY = WS-KEY2                 
    MOVE WS-ACCT-TO-ACCT TO NACCT-NO
END-IF.                             

IF WS-KEY = WS-KEY3             
    MOVE WS-DEPT-NBR TO NEW-FA-BR
END-IF.                         

IF WS-KEY = WS-KEY4                             
    MOVE WS-SPLT-FC-ASST TO PRI-FA-SPLT-FC-INFO 
END-IF.   
                                     
PUT OUTFILE.                                     


Please note that here we have to extract different fileds from different input files by comparing the branch number of reference file with the branch number of each of the other files and write it to a single output file.
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: Thu Oct 16, 2008 9:52 am
Reply with quote

Hello,

I believe jour JOB INPUT will work for the 5 files.

I believe your code to determine syncronization needs to be different. IIRC, you would use IF MATCHED to detect that all files matched. You would use IF MATCHED f1, f2 for the compare of only file1 to file2. And so on matching the first file against the other files.

You might also code to ensure a particular file currently has data (IF FILENAME or IF NOT FILENAME) or is at end of file (IF EOF FILENAME or IF NOT EOF FILENAME).

Good luck and i'll check back when i get online again.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Oct 16, 2008 2:50 pm
Reply with quote

Dick,

Thanks for the information. I have changed the matching logic as suggested above and program is running.

Reference (FLSBRNCH) file has 50 records and out of 4 other files, one file (INFODLY) has about 12 Million records and all other files have in hundreds and thousands. Job is running for the last 2.5 hours.

Is there any way to reduce the time?
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: Thu Oct 16, 2008 8:09 pm
Reply with quote

Hello,

Quote:
Is there any way to reduce the time?
How long does it take to simply read the 12millon record file in Easytrieve (without matching against anything). How long in a simple cobol program? Does the file have disp=old or might something else be reading it at the same time?
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Oct 20, 2008 3:39 pm
Reply with quote

Dick,

We are now extracting with limited number of records for testing and facing the following problem.

When we are writing signed packed decimal value into output file by readi ng an input file, it's writing the value correctly but sign part is writing with spaces.

Input declaration is as below.

Code:

FILE RELHST  F 74                 
     WS-KEY4            1  3 A   
     WS-DATA7           4  8 A   
     WS-DATA8           12 51 A   
     WS-SPLT-FC-ASST    63 5 P 5 
     WS-SPLT-FCT-GR     69 5 P 5 


Output declaration is

Code:

FILE OUTFILE F 66                     
     PRI-FA-KEY           1  6  A     
     PRI-FA-SPLT-FC-INFO  7  5  P 5   
     PRI-FA-SPLT-FC-INFO1 13 5  P 5   
     NACCT-NO             19 16 A     
     NEW-FA-KEY           35 6  A     
     NEW-FA-BR            41 6  A     
     NEW-FA-SPLT-PCT-F    47 5  P 5   
     NEW-FA-SPLT-PCT-F1   53 5  P 5   
     OUT-KEY              59 3 A     
     OUT-KEY1             62 5 A     


Input value as shown below.

Code:

...°.....°..
000900000900
00000C00000C


Output also should be displayed as above but it's displaying spaces inplace of sign.

Code:

00090[b]4[/b]00090[b]4[/b]
00000[b]0[/b]00000[b]0[/b]


In the above example, spaces are getting displayed inplace of sign. What could be the problem for the above? Everything is getting displayed properly except SIGN part.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Oct 20, 2008 8:44 pm
Reply with quote

Please note that above values are for Packed Decimal fields (PRI-FA-SPLT-FC-INFO, PRI-FA-SPLT-FC-INFO1, NEW-FA-SPLT-PCT-F and NEW-FA-SPLT-PCT-F fields)
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: Mon Oct 20, 2008 9:24 pm
Reply with quote

Hello,

I believe what has happened is that the data is 6 positions long but has been defined as 5. The spaces are the unspecified bytes between the fields.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Oct 20, 2008 10:00 pm
Reply with quote

Data has been defined as 5P5, 5 positions before decimal position and 5 positions after decimal position. So, total memory 6 bytes ((5+5+1)/2=5.5=6 bytes).

Spaces are not unspecified bytes, we have checked twice. When we declared 4 bytes after decimal (5P4), space was truncated and all other digits were displayed except sign.

Defining signed packed decimal as "P" is enough or we have to handle sign differently? Also after writing into output file, we initialized all fields.
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: Mon Oct 20, 2008 11:57 pm
Reply with quote

Hello,

Checking many times will not help. . . . icon_confused.gif

You have defined the fields to be 5 bytes in length - not 6.
Quote:
{field-length}
Field-length specifies the length (in bytes) of the defined field. Field-length
must be an unsigned integer.
Simply said, the definitions do not match the input data and the definitions leave an open byte beteween the fields in the output which is where the unwanted blanks/spaces originate.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Tue Oct 21, 2008 9:01 am
Reply with quote

Thanks Dick. Program got executed successfully after changing the declaration to 6P5.
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 Oct 21, 2008 9:01 am
Reply with quote

Hello,

Code:
FILE RELHST  F 74                 
     WS-KEY4            1  3 A   
     WS-DATA7           4  8 A   
     WS-DATA8           12 51 A   
     WS-SPLT-FC-ASST    63 5 P 5 
     WS-SPLT-FCT-GR     69 5 P 5 


Code:

...°.....°..
000900000900
00000C00000C


Note that the actual posted data is 2 6-byte fields, not 5. Also note, that when the length is added to the displacement of a field in the file definition, the next displacement results - except fot the last 2 fields. I believe those field definitions should be "nn 6 P 5".
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 Oct 21, 2008 9:03 am
Reply with quote

We were typing at the same time. . .

Good to hear it is working - thanks for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Nov 10, 2008 9:48 am
Reply with quote

Dick,

I have one question here on declaration of the field.

I want to have 5 digits after decimal and 1 digit before decimal.

E.g.,
Code:

0.10000
1.00000 so on...


For this I have declared the variable as 1 P 5, but it's giving invalid declaration. And I found from the available Easytrieve manual that before decimal declaration must be greater than or equal to the after decimal declaration.

If we want to have values as shown above, how should we declare the variable?
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: Mon Nov 10, 2008 9:54 am
Reply with quote

Hello,

Try 6 P 5 (length of 6 with 5 positions after the decimal).
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Nov 10, 2008 1:33 pm
Reply with quote

Thanks Dick. I have declared as 6P5 but I was thinking this declaration is for 6 digits before decimal and 5 digits after decimal. Thanks for clarification.

Regards,
KSK
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(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top