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

pagination logic


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Tue Aug 16, 2005 4:15 pm
Reply with quote

Could anyone please give the logic for map pagination in cics asap?
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Wed Aug 17, 2005 9:34 am
Reply with quote

I guess the following will give you a clear idea abt paging.There are many ways of paging.The example below shows you abt paging in CICS thru COBOL.

| I Scr | II Scr | III Scr |
-------------------------------------
A B C |C D E |F G H |
-------------------------------------
........ |........ |..........|.................................
........ |........ |..........|.................................
........ |........ |..........|.................................
........ |........ |..........|.................................
........ |........ |..........|.................................
........ |.........|..........|.................................

Let us consider 4 screens.You can assign any of the funtional keys to browse thru the number of screens using DFH parameter in CICS.
The following code in COBOL can be used for paging.

IF AID-VE = DFHPF11
ADD +1 TO SWAP-KEY
IF AID-VE = DFHPF10
SUBTRACT +1 FROM SWAP-KEY.
IF SWAP-KEY > +4
MOVE +1 TO SWAP-KEY
IF SWAP-KEY < +1
MOVE +4 TO SWAP-KEY

following the above:
If swap-Key = 1 then you need to move the fields to the corresponding positions in the screens.
eg:In the I scr the fields are A, B, C..Move A to the corresponding position in the screen.
Populate the field values accordingly.

By doing the above way,it is easier to do paging and to change the number of screens with slight changes in the code in cobol,whenever needed.

Pleasure to answer further queries,if any
Back to top
View user's profile Send private message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Wed Aug 17, 2005 11:17 am
Reply with quote

Hi radhakrishnan,

Thanx for your suggestions.

I would like to give the senario. Suppose we have 1000 records in our database to be displayed on the map. And we want to see the resord with F8 (Next Page) and F7( Prior Page). So, as per your logic i cant hard code 'IF SWAP-KEY > +4'.

Now, when i am at 10th page and wants to see the 7th one then how can be track the record of 7th page.

Please advise if you have any idea.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Wed Aug 17, 2005 11:59 am
Reply with quote

Swap-key>+4 is applicable for 4 screens as i had mentioned earlier as an example.And its for horizontal swap.

You are talking abt vertical paging.
Let me explain my views to your current problem now:

Consider single screen can hold upto 10 - 15 records.
Fetch records from table and write it into the vsam.You read those records from the file and display it in the screen(12 records per screen)

IF HKEY-AT-CURSOR-SPSV > +1
AND HKEY-AT-CURSOR-SPSV < +12
MOVE HKEY-L00-SPSV (HKEY-AT-CURSOR-SPSV) TO HKEY-A-SPSV
ELSE
MOVE HKEY-L00-SPSV (01) TO HKEY-A-SPSV.

IF HKEY-A-SPSV = HKEY-FIRST-SPSV
OR HKEY-A-SPSV = LOW-VALUES
PERFORM 68-GET-LAST-PAGE
GO TO THIS-EXIT.

PERFORM 63-GET-KEY.
MOVE SCREEN-DATAO (01) TO SCREEN-DATAO (12).
MOVE HKEY-L00-SPSV (01) TO HKEY-L00-SPSV (12).
MOVE LOW-VALUES TO HKEY-L00-SPSV (01).

IF HKEY-AT-CURSOR-SPSV > +1
AND HKEY-AT-CURSOR-SPSV < +12
MOVE +12 TO X3-SYS
ELSE
MOVE +13 TO X3-SYS.
PERFORM 65-GET-PRIOR.

---------------------------------------------------

68-GET-LAST-PAGE SECTION.

MOVE HKEY-LAST-SPSV TO HKEY-A-SPSV.
PERFORM 63-GET-KEY.
MOVE SCREEN-DATAO (01) TO SCREEN-DATAO (12).
MOVE HKEY-L00-SPSV (01) TO HKEY-L00-SPSV (12).
MOVE LOW-VALUES TO HKEY-L00-SPSV (01).
MOVE +12 TO X3-SYS.

--------------------------------------------------
In get key move low-values to SCREEN-DATAO (01),(02)...(12)
--------------------------------------------------
65-OUT.

IF HKEY-L00-SPSV (12) = HKEY-LAST-SPSV
MOVE 'BOTTOM OF DATA' TO MESSAGE-WS.
IF HKEY-L00-SPSV (01) = HKEY-FIRST-SPSV
MOVE 'TOP OF DATA' TO MESSAGE-WS.
----------------------------------------------------
For last page
MOVE HKEY-LAST-SPSV TO HKEY-A-SPSV.
for first page
MOVE HKEY-FIRST-SPSV TO HKEY-A-SPSV.

--------------------------------------------------------

hope this helps.
Back to top
View user's profile Send private message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Wed Aug 17, 2005 12:03 pm
Reply with quote

Thanx alot Radhakrishnan,

Thats what i am looking for. Thank you very much.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Wed Aug 17, 2005 3:52 pm
Reply with quote

you are welcome
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
No new posts Rexx Logic error while adding seperat... CLIST & REXX 3
No new posts PL/1 Callback address logic in z/OS C... PL/I & Assembler 1
No new posts Sync logic between VSAM files and DB2... COBOL Programming 9
Search our Forums:

Back to Top