× Discuss on Template programming, jBASE programming, Enquiries, No-File enquiry, Enquiry routines, Version, Version routines, Menus, Abbriviations, Creating local reference fields, Fast path enquiries, Creating charts and graphs, Generating Reports, Deal slips, Straight through processing, Multi Company and Multi Book setup, Tabbed screens, Composite Screens, T24 API, etc...

WRITE MULTI THREAD ROUTINE FOR COB

  • cemtezer
  • cemtezer's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 2 months ago #15434 by cemtezer
WRITE MULTI THREAD ROUTINE FOR COB was created by cemtezer
Hi, I tried to write a code to work multi thread for job in COB, anyone help me about how can i do multi thread process.

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • TAFj-R20 - 'unix'
More
10 years 2 months ago - 10 years 2 months ago #15437 by jpb
Replied by jpb on topic WRITE MULTI THREAD ROUTINE FOR COB
1. Create 3 routines and an insert file:
Main routine
SUBROUTINE MY.SERVICE(NEXT.ID)
*-----------------------------------------------------------------------------
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_MY.SERVICE.COMMON
*-----------------------------------------------------------------------------
Select routine
SUBROUTINE MY.SERVICE.SELECT
*-----------------------------------------------------------------------------
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_MY.SERVICE.COMMON
*-----------------------------------------------------------------------------
* Main SELECT
...
* Build "key only" file
CALL BATCH.BUILD.LIST(SEL.COMMAND,SEL.LIST )
RETURN
END
Load routine
SUBROUTINE MY.SERVICE.LOAD
*-----------------------------------------------------------------------------
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_MY.SERVICE.COMMON
*-----------------------------------------------------------------------------
FN... = 'F...'
F... = ''
CALL OPF(FN..., F...)
RETURN
END
Insert file
* File: I_MY.SERVICE.COMMON
COMMON /MY.SERVICE.COMM/ FN..., F...

and compile/catalog all.

2. Create PGM.FILE for MY.SERVICE with BATCH.JOB set to @BATCH.JOB.CONTROL
3. Place your routine in the BATCH of your choice
Last edit: 10 years 2 months ago by jpb. Reason: removed .TEST in first examlpe
The following user(s) said Thank You: cemtezer

Please Log in or Create an account to join the conversation.

  • cemtezer
  • cemtezer's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 2 months ago #15545 by cemtezer
Replied by cemtezer on topic WRITE MULTI THREAD ROUTINE FOR COB
firstly, thank you very much your given information.

i just dont understand one point that is INSERT.FILE

you mean, for example my related file is ACCOUNT.

JED LOCAL.BP I_MY.SERVICE.COMMON

001> COMMON /MY.SERVICE.COMM/ FN.ACCOUNT, F.ACCOUNT

then save file (with FI). (Is MY.SERIVCE.COMM is a variable or an important istance?)

Regards.

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • TAFj-R20 - 'unix'
More
10 years 2 months ago - 10 years 2 months ago #15549 by jpb
Replied by jpb on topic WRITE MULTI THREAD ROUTINE FOR COB
The insert file is used to declare all variables that will be used in the 3 routines in common, e.g. all file-variables that will be opened in .LOAD and used in main routine.
Other "candidates" are :
- parameterrecords
- position of local fields
- calculated dates for selection

The /MY.SERVICE.COMM/ is the name of the common making it a Named-Common that it can be shared between routines and not only with subroutines. See here
Last edit: 10 years 2 months ago by jpb.
The following user(s) said Thank You: cemtezer

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #15597 by kripesh
Replied by kripesh on topic WRITE MULTI THREAD ROUTINE FOR COB
Just a small correction the post given by jpb... The names of the SUBROUTINE should be same except for LOAD and SELECT at the end.

Eg. HELLO.WORLD.LOAD
HELLO.WORLD.SELECT
HELLO.WORLD

To add to the this some rules that needs to be followed are..

1. The name of the BATCH record and the TSA.SERVICE record should be the same.
2. The BATCH record should have a value filled in the BATCH.STAGE field
3. PGM.FILE that you create should be only for the process routine. ie. HELLO.WORLD and not for the .SELECT and .LOAD subroutines.
4. PGM.FILE type should be set to B.
5. BATCH.JOB field in PGM.FILE should be blank or @BATCH.JOB.CONTROL to denote it is a multi-threaded subroutine.
6. The .SELECT subroutine should have a CALL BATCH.BUILD.LIST('',SEL.LIST)
7. SEL.LIST is nothing but the variable use as the second parameter in your CALL EB.READLIST()

Have a great day !

Please Log in or Create an account to join the conversation.

Time to create page: 0.137 seconds