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

need help in easytrieve-multiple reading of sequential file


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

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Wed Jun 04, 2008 12:07 pm
Reply with quote

i have a situation like, there are 2 files A and B(BOTH ARE PS). For each record in A the FILE B has to be read for the some condition.
for the above logic i tried 2 ways.
1.)job input A
GET B
CHECK LOGIC
PRINT O/P
IF i am doing this then the FILE B is reaching the end of file and giving the logical error.can u help me by saying how can i make the pointer go the first record of B after each record in A is processes.
2.)i tried IF MATCHED(FILEA(KEY) FILEB(KEY))
But it is only reading the file B ONLY ONCE.

CAN AMYONE SUGGEST A SOLUTION FOR THIS.BOTH FILES ARE PS
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:54 pm
Reply with quote

If FILEB is relatively try declaring it as a TABLE and do a search.

Thanks
Manu
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 04, 2008 7:58 pm
Reply with quote

Hello Chandra and welcome to the forums,

Quote:
how can i make the pointer go the first record of B after each record in A is processes.
You can't - easytrieve does not do this.

You need to use a 2-file match/merge to do what you need.

Easytrieve has a match function (documented in the ezt manual) od you could use cobol. There is a "Sticky" near the top of the COBOL section of the forum that contains working sample code for what i believe is your requirement.

Download and review the sample code and post back here if there is something you do not understand. I have not done so, but i believe the same logic could be used in ezt if tyhe ezt match does not do what you need.
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Thu Jun 05, 2008 1:23 pm
Reply with quote

hi
thanks for ur reply, and i have some questions about a table which i thought can be helped by u.
1.)my sequential file has around 600 rceords.so its an external table
2.)do i have to get the records sorted in ALPHABATECIAL ORDER IN THE PS to declare it as a table.
3.)file inpfile table {literal-10}
arg 1 16 a desc 17 44 a

this is the decleration i have to give for external table decleration.
if my file size is not variable can i declare it to have an approximate size.

if i am mistaken pls correct me.
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Thu Jun 05, 2008 10:12 pm
Reply with quote

hi
thanks for the reply.
wat my inclination towards "if matched " was
if FILEA has no dups FILEB has dups and
now for every record in FILEB, FILEA has to be searched.

so

job input(filea(key1) -
fileb(key2))

if matched
{process}
goto job

i was thinking that for if matched the FILEA is not bieng searched every time fileb is read.
our requirement is it should be read multiple times.so after every job input will the filea be read from the top again.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 06, 2008 2:09 am
Reply with quote

Hello,

Quote:
our requirement is it should be read multiple times
If both files are in the proper sequence, i believe there is no need to read either file multiple times.

If the build-in easytrieve "match" does not do what you need, i'd suggest using the above mentioned cobol code or converting that code to easytrieve if there is some need to use easytrieve.

A properly coded "match" will only process each record of each file one time.

Unless there is something in the requirement that i do not yet understand.
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Fri Jun 06, 2008 12:04 pm
Reply with quote

i tried using "matched" and found that
both the files should be soted before using "matched"

FILEA - HAS NO DUPS(THINK ITS THE MASTER)
FILEB - HAS DUPS

BOTH FILES SHOULD BE SORTED BEFORE USING MATCHED

NOW MY REQUIREMENT IS GETTING SATISFIED WHEN I USE "IF MATCHED (FILEA(KEY1)+
(FILEB(KEY2)) "
FOR EVERY KEY IN FILEB WE HAVE MANY DUP KEYS IN FILEB.
SO ITS ABLE TO MATCH WHEN USING THE ABOVE LOGIC.

EVEN IF THE FILE ORDER IN "IF MATCHED()()" IS CHANGED ITS NOT ABLE TO DO IT.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Fri Jun 06, 2008 2:55 pm
Reply with quote

Can you try using the Search TABLE and then using the IF MATCHED. This might not be efficient method but it works.

Mods,

There are two topics running for the same issue i guess.

Other one is ibmmainframes.com/viewtopic.php?p=136824#136824

Can we merge these two or close one of them
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 06, 2008 7:43 pm
Reply with quote

Hello,

This topic and one titled "Processing table in eastrieve " are the same. I am closing the other topic as we don't need the same discussion 2 places.

I suggest you try the previously mentioned match/merge code. It should only take a short amount of time and you will have another "tool" that you will be able to use over and over for other requirements.
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Fri Jun 06, 2008 11:10 pm
Reply with quote

thank u for ur suggestion,i will try that
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Jun 07, 2008 12:34 am
Reply with quote

You're welcome - good luck icon_smile.gif

Someone will be here if there are questions.

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

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Mon Jun 09, 2008 12:36 pm
Reply with quote

hi this is working gr8

JOB INPUT SAM2
W-COUNTER = 0
MOVE SAM2-FIRST TO W-SAM2-FIRST
SEARCH SAM1 WITH W-SAM2-FIRST GIVING W-DESCRIPTION
IF SAM1
W-FLAG = W-FLAG + 1
DISPLAY 'FOUND'
W-COUNTER = W-COUNTER + 1
DISPLAY W-FLAG
GO TO JOB
END-IF
IF W-COUNTER EQ 0
DISPLAY 'NOTFOUND' W-SAM2-FIRST
END-IF
GOTO JOB
the sequential table is the only thing thats sorted the other sequential file need not be sorted.

thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 09, 2008 7:36 pm
Reply with quote

Hello,

Well, hopefully, the volume will be very small and the process will run very seldom. While that code may work it will waste an incredable amount of system resources (the larger the run, the more waste). I suppose this could be a good thing if your family sells hardware. . .
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Tue Jun 10, 2008 11:20 am
Reply with quote

but what can be done if not a table, sequential processing is itself resource consuming.
we have to use vsams instead.but our requirement is not the same.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 10, 2008 1:27 pm
Reply with quote

Hello,

Have you yet downloaded and used the 2-file match/merge code? Do so and i believe you will see a reduction in resources used.

Reading 2 files sequentionally uses less resources than running back and forth thru some table/array.
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Wed Jun 11, 2008 12:51 pm
Reply with quote

ya i downloaded that code given and i will see the feasibility of implementing it.


thats a gr8 suggestion

thank u
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jun 12, 2008 3:29 am
Reply with quote

Hello,

Quote:
ya i downloaded that code given and i will see the feasibility of implementing it.
Good luck - someone will be here if there are questions icon_smile.gif

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

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Fri Jun 13, 2008 12:17 pm
Reply with quote

hi

i have a scenario like i have to insert records in a table that has been defined by me

the layout of table is

inpfile
arg 1 21 A
desc 22 44 A

WHEN I AM TRYING TO INSERT RECORDS IN THIS TABLE USING ARG AND DESC ITS SAYING *******B082 NAME IS UNDEFINED - ARG
*******B082 NAME IS UNDEFINED - DESC
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 13, 2008 1:22 pm
Reply with quote

Hello,

Please post the problem code and the associated info from the sysout=.
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 Unable to interpret a hex value to De... COBOL Programming 7
No new posts Overwriting SSN Digits in Easytrieve ... CA Products 0
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6
Search our Forums:

Back to Top