Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Easytrieve program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 6:52 pm    Post subject: Easytrieve program
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: 2360
Location: Israel

PostPosted: Wed Jan 14, 2009 7:31 pm    Post subject:
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: 92
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 7:43 pm    Post subject:
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    Post subject:
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: 92
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 9:02 pm    Post subject:
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    Post subject:
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: 92
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 11:14 pm    Post subject:
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

Site Director


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

PostPosted: Wed Jan 14, 2009 11:56 pm    Post subject:
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: 92
Location: Hyderabad

PostPosted: Thu Jan 15, 2009 12:06 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Easytrieve report shalem CA Products 4 Sun Feb 26, 2017 9:08 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us