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

Easytrieve program


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

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 6:52 pm
Reply with quote

Hi all,
can anyone help me for below requirement in Easytrieve

I have one VSAM FILE V1 as below

subdealer-code
dealer-code
address-1
address-2

recored ex:

AAA BBB mumbai north-central
BBB BBB mumbai west-central
CCC BBB mumbai east-central
DDD BBB mumbai south-central


my requiremnet is I want to do a random search to find out the address-2 where dealer and subdealer are same.
in my example it will be BBB and address-2 which will be displayed is west-central
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Jan 14, 2009 7:31 pm
Reply with quote

and the question is...?

O.
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 7:43 pm
Reply with quote

Quote:
my requiremnet is I want to do a random search to find out the address-2 where dealer and subdealer are same
Back to top
View user's profile Send private message
aluru_m

New User


Joined: 22 May 2008
Posts: 5
Location: New Jersey

PostPosted: Wed Jan 14, 2009 8:53 pm
Reply with quote

Deep,

You need another sequential file or user input to read the subdealer-code. Next read the VASM file with the key, if sub-dealer code equal to dealer code get the address.

Define the Vsam file and Read with the key

FILE V1 VS
subdealer-code
dealer-code
address-1
address-2


READ V1 KEY subdealer-code STATUS
IF FILE-STATUS EQ 0
IF subdealer-code = dealer-code
get the address
END-IF
END-IF
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 9:02 pm
Reply with quote

My Key is of 10 charcter length
can I check for only few character of the key.
For eg.
WS-VAR =' AAAA '
READ V1 KEY WS-VAR STATUS

I want to fetch the records which has AAAA at 4 position
Back to top
View user's profile Send private message
aluru_m

New User


Joined: 22 May 2008
Posts: 5
Location: New Jersey

PostPosted: Wed Jan 14, 2009 10:29 pm
Reply with quote

Create two fields in the input file layout - 1-4 and 5-10 then read with the first field subdealer-code1.

FILE V1 VS
subdealer-code1
subdealer-code2
dealer-code
address-1
address-2
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 11:14 pm
Reply with quote

I can not change the Input File structure as its being used in multiple places.
The KEY in input file is of 10 char long . Where as I need to check only from 4th to 8th pos(4char) as the key ...
Can we have something like % as we have in DB2...
Or do we have any other option where in I can just use part of the key to retrive the record randomly...
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: Wed Jan 14, 2009 11:56 pm
Reply with quote

Hello,

Quote:
I can not change the Input File structure as its being used in multiple places.
You can use an alternate definition in your program without changing the "global" definition. You would define the bytes you want to reference as another field. The access would be sequential rather than random.
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Thu Jan 15, 2009 12:06 am
Reply with quote

Here is a small ex:
My Key is of 10 charcter length in input file
which is a combination of two fileds
Field1-6
field2-4

records for the input file(V1):
---------
111111BBBB
222222CCCC
333333DDDD
111111EEEE
222222AAAA

now if i give the below read stmt

For eg.
WS-VAR ='AAAA'
READ V1 KEY WS-VAR STATUS
then will it retrieve the record 222222AAAA.

For me I gets File Status code as 16 . I think its for record not found.

Please let me know If my requirement is not clear...
Back to top
View user's profile Send private message
aluru_m

New User


Joined: 22 May 2008
Posts: 5
Location: New Jersey

PostPosted: Thu Jan 15, 2009 1:03 am
Reply with quote

You cannot read a file with variable. You need to use the field name that is defined as file layout. There is NO harm in defining the fields as in order of layout it will not change the file structure.

Define as

FILE V1 VS
subdealer-code1 1 6 N
subdealer-code2 7 4 N
dealer-code
address-1
address-2


READ V1 KEY subdealer-code2 STATUS
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 Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top