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
 

 

Refresh current position

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
View previous topic :: :: View next topic  
Author Message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Thu Feb 11, 2010 3:04 pm    Post subject: Refresh current position
Reply with quote

Hi,

My input file is like below.

Code
------
P500
P300

My IMS segment occurrences are like below.

P3008XYA1234 - Key is P3008XYZ
P3008XYB3256 - Key is P3008XYB
P3008XYC7412 - Key is P3008XYC
P4008XYC7555 - Key is P4008XYC
P5009XYA3253 - Key is P5009XYA
P5009XYB8522 - Key is P5009XYB
P6009XYA8527 - Key is P6009XYA

I want to fetch all the records matching my input file code. Since i have only 'Partial Key', I issue a GN call with Qualified SSA with key as below.

Key >= P500

I will now be able to fetch both the P500 segments occurrences.
Then i read the next record from input which is P300.

I now modify my qualified SSA with key as below -

Key >= P300

Then i issue a GN call, but it fetches 'P6009XYA8527' not what i need (P3008XYA1234).

However if i sort my input file so that it is like below

Code
------
P300
P500

then changing the SSA with new code fetches me correct data, i.e., it fetches P5009XYA3253 after P3008XYA1234 and not P4008XYC7555 as it
was doing in the previous case.

For the first case (without sort),
I think i need to refresh the current position first before issuing a GN call for each input project code. But can you tell me how to do that?

Any suggessions welcome?
Back to top
View user's profile Send private message

Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Feb 16, 2010 12:48 am    Post subject:
Reply with quote

Keep in mind that IMS does not have a "read previous". You are positioned at your last successful call. You are keyed sequential. I would always sort my input file in sequential order.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Tue Feb 16, 2010 10:15 am    Post subject:
Reply with quote

what about using GU Key >= code-key and then using GN

With this you need not sort the input file by code.

Thank you
Ajay
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Feb 16, 2010 5:25 pm    Post subject:
Reply with quote

Why would you make more work for IMS? Remember that IMS is positional.

If you want to go sequentially from lowest database key to high, you need to sort your input file in sequential order. IMS is NOT DB2. IMS reads left to right in the database. We do not do "fetches" in IMS. It will take you about 5 minutes total to put together an external sort and the JCL against that input file.

The below logic is correct. Once you position yourself on the first segment with that partial key, then you can GN UNTIL the partial key changes. If you want ONLY segments with the partial keys on your input file, you will need to check if the segment retrieved has a different partial key. You will then load the partial key from your input file - making sure to check if you have already retrieved a segment match.

Quote:
I want to fetch all the records matching my input file code. Since i have only 'Partial Key', I issue a GN call with Qualified SSA with key as below.

Key >= P300
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Thu Feb 18, 2010 3:53 pm    Post subject:
Reply with quote

I found a way to deal with this when input is not sorted.

I simply moved
1) Project code to PROJ1 and PROJ2
2) low-values to FIL1
3) high-values to FIL2
4) '&' to OP

in below SSA and perform until 'GE' to get my required segment occurrences.

Code:
01 SSA-PRO.                                           
   05 SEGMENT-NAME         PIC X(8) VALUE 'SUBPMT   '.   
   05 FILLER               PIC X(1) VALUE '('.           
   05 FIELD-NAME1          PIC X(8) VALUE 'PROJNO  '.   
   05 FILLER               PIC X(2) VALUE '>='.         
   05 KEY1.                                             
     10 PROJ1              PIC X(4).                     
     10 FIL1               PIC X(27).                   
   05 OP                   PIC X(1) VALUE '&'.           
   05 FIELD-NAME2          PIC X(8) VALUE 'PROJNO  '.   
   05 FILLER               PIC X(2) VALUE '<='.         
   05 KEY2.                                             
     10 PROJ2              PIC X(4).                     
     10 FIL2               PIC X(27).                   
   05 FILLER               PIC X(1) VALUE ')'.   


Thanks
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 -> IMS DB/DC All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Retrieve current year or month using ... vnktrrd DFSORT/ICETOOL 15 Tue Mar 15, 2016 4:14 pm
No new posts ISREDIT - Position Cursor on the Comm... Tarique Anwer TSO/ISPF 5 Wed Feb 03, 2016 12:44 pm
No new posts Adjust Heading Position in Easytrieve thesumitk CA Products 4 Mon Dec 21, 2015 3:26 pm


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