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

Equivalent 'CICS DELAY' function in COBOL.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Sep 03, 2012 12:42 pm
Reply with quote

I know there is a CICS DELAY function which can let the program suspend for a specified time, but I want this function in COBOL program which is not supposed to be run in CICS region.

I looked into COBOL manual, but no result found.
Can u suggest a better way to realise this?

thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Sep 03, 2012 12:49 pm
Reply with quote

the better way would be not to do it at all,
the operations team would not be glad to see an initiator hanging around doing nothing .
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Sep 03, 2012 12:51 pm
Reply with quote

Why do you want your program to "wait" (locking-up resources)?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 03, 2012 1:51 pm
Reply with quote

dejunzhu,

if you would learn to search,
you can avoid all the questions.

CALL an HLASM module which uses the BPX1SLP, BPX4SLP services

I have used this technique in 'permanent running batch modules'
(as started tasks)
when I wanted to wait for some types of db2 -904's to clear up.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 03, 2012 4:23 pm
Reply with quote

here is a copy of the asm module I used 10 years ago
Code:

ASMSUSP  TITLE 'WAIT FOR SPECIFIC TIME PERIOD'
         SPACE 3
         PRINT GEN
*********************************************************
* USED MACROS FOR LE COMPATIBILTY:
*     CEEENTRY
*     CEETERM
*     CEEPPA
*     CEECAA
*     CEEDSA
*
* CALLED MVS SERVICES:
*     -----     --------------                                     
*     BPX1SLP   THE SLEEP CALLABLE SERVICE SUSPENDS RUNNING       
*               OF THE CALLING THREAD (PROCESS) UNTIL THE NUMBER OF
*               SECONDS SPECIFIED BY THE PARAMETER SECOND         
*               HAS ELAPSED, OR UNTIL A SIGNAL IS DELIVERED       
*               TO THE CALLING THREAD TO INVOKE A SIGNAL-CATCHING 
*               FUNCTION OR END THE THREAD.
*
*
* INPUT PARAMETER:
*     -----     --------------                  ---------------
*     SLEEPT    SLEEP TIME IN SECONDS           F / PIC S9(9) BINARY
*                                                                   
* OUTPUT PARAMETER:                                                 
*     -----     --------------                  ---------------     
*     RETVAL    IF TIMER ELAPSED PRIOR TO       F / PIC S9(9) BINARY
*               REQUSTED; OTHERWISE 0                               
*                                                                   
* SAMPLE CALL FROM COBOL FOR 5 SECONDS:
*           COMPUTE SLEEPT = 5         
*           CALL ASMSUSP 
*                USING SLEEPT
*                    , RETVAL   
*           END-CALL     
*                                           
R1       EQU   1          ADRESSLIST       
R3       EQU   3          WORK REGISTERER   
RBASE    EQU   11         BASE REGISTER     
R14      EQU   14         RETURN TO CALLER 
R15      EQU   15                           
DFA002   CEEENTRY MAIN=NO,NAB=NO,BASE=RBASE,AUTO=SLDSAL
*                                                       
         MVC   PARMLIST(PARMLL),0(R1) ADDRESS PARAMETER LIST
         L     R3,SLTADDR                             
         MVC   SLEEPT,0(R3)                           
*                                                     
         CALL  BPX1SLP,(SLEEPT,RETVAL)                 
         L     R3,RETADDR                             
         MVC   0(L'RETVAL,R3),RETVAL                   
         CEETERM ,                RETURN TO CALLER     
SLEEPT   DS    F                                       
RETVAL   DS    F                                       
         LTORG                                         
PPA      CEEPPA ,VER=03,REL=01,MOD=00   PROGRAMM PROLOG AREA     
         SPACE 3                   ------------------------------
         CEECAA ,                  MAPPING OF COMMON ANCHOR AREA
         CEEDSA ,                  MAPPING FOR DYNAMIC SAVE AREA
**** VARIABLES     **************************************       
PARMLIST DS    2A                                               
         ORG   PARMLIST                                         
SLTADDR  DS    A                                                 
RETADDR  DS    A                                                 
         ORG                                                     
PARMLL   EQU   *-PARMLIST                                       
SLDSAL   EQU   *-CEEDSA                                         
*                                                               
         END                                                     


have not done asm for 10 years,
so if any of the asm guys see a problem,
please post any changes that may be needed.
thx
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Sep 03, 2012 4:56 pm
Reply with quote

Thanks, Dick,

I examined <Language Environment reference> and found callable service CEEDLYM might do this.
I'm testing on CEEDLYM. if it works, I want to use it.
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: Tue Sep 04, 2012 7:43 am
Reply with quote

Hello,

NO - You DO NOT want to use it.

You are trying to get around a poor design issue by using a worse solution.

Somethin you (and many others) need to learn is that just because a "thing" can be done - often it SHOULD NOT be done.

As i have mentioned before, you are creating a nightmare. . . Both for running and subsequent maintenance.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 04, 2012 8:15 am
Reply with quote

Dejunzhu said -
Quote:
but I want this function in COBOL program which is not supposed to be run in CICS region.

You should be able to isolate this function by comparing the valid APPLID's (where this function can be run) with the current APPLID and take action. To obtain the APPLID of the current region, issue the CICS ASSIGN API.

Issuing a DELAY in CICS is not good programming practice and you need to consider an alternative, such as, writing a TDQ message to CSMT/CSSL (include, amongst other fields, the USERID from the ASSIGN API), issuing a WRITE OPERATOR message (optional, check with operations first) and terminating the task.
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: Tue Sep 04, 2012 8:29 am
Reply with quote

Hi Bill,

I believe this is so some batch job can hang aroung "waiting" . . .

d
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 04, 2012 8:45 am
Reply with quote

Dick,

So, this might be a Client/Server arrangement?

This should be easy enough to determine by checking all the valid target APPLID's in the Client program and bypass linking to the Server program.

If he's using a DPL to the Server program in the target region, the target APPLID is a required keyword/value.

Sometimes, he doesn't make things too clear or maybe it's me, slowly losing it in my older years? icon_rolleyes.gif
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: Tue Sep 04, 2012 8:58 am
Reply with quote

Hi Bill,

From what i can tell (there have been many posts that reflect that the design is terribly flawed), this is an attempt to get around having locking/timeout issues between batch and online.

I'd shudder to guess what will happen if another layer (c/s) is implemented with no expertise also . . .

d
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Sep 04, 2012 10:27 am
Reply with quote

An alternate approach which worked out fine in my case

what you could do is execute stuff when the db2 resources are available so before you runn your program you could have a step doing -DIS with the output you can proceed doing different things

Experts will that do any good?
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Sep 04, 2012 11:24 am
Reply with quote

hi, experts,

below is what I want to do :

when mode is changed from online to batch, the first thing is to wait online process complete, and then take copy against master tables.

so, how to determine if all transaction has been completed? there is a table , let's say, transaction status table. When a transaction start, it will register in the table, and record the status as 'IN PROCESS', when the transaction ends, it will update the record in the status table to 'SUCCESS' or 'FAILED'.

so, I have to check the status all the time, untill there is no more transaction that is in 'IN PROCESS' status. To do this, when I check it and determined not all transactions have completed, I have to wait for some seconds and check it again. During this wait process, I have to hang on the check-program.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Sep 04, 2012 2:07 pm
Reply with quote

what a horrible waste of time and resource..
the topic is going down the path ... how to write Your own scheduling system

or better towards utter stupidity, like many of the topics from the same TS icon_evil.gif

it might be locked very shortly
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top