× 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...

How to call a subroutine from inside another ?

  • Moe_T24
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • T24 Technical
More
7 years 11 months ago #19334 by Moe_T24
Hello ,

How can I call a subroutine from inside another subroutine? Should $INCLUDE be used to imoirt it. Where should the subroutine exist ?

Thanks .

Best Regards

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

More
7 years 11 months ago #19335 by mrul3s
Create PGM.FILE of subroutine which you want to call another routine with TYPE.............. S

and call this subroutine to another routine with function CALL
Like,

CALL SUBROUTINE.NAME

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

  • Moe_T24
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • T24 Technical
More
7 years 11 months ago #19336 by Moe_T24
Yeah I know that. But should you use like $INCLUDE SOME.ROUTINE.NAME .
Because I call it but it gives error when compile .

Best Regards

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

  • Moe_T24
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • T24 Technical
More
7 years 11 months ago #19337 by Moe_T24
Ok solved it. misspelling in the called routine name ! My bad !

Thanks anyway .

Best Regards

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

  • VK
  • VK's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Globus:G09-G13|TAFC:R05-R23|TAFJ:R19,R23:test
More
7 years 11 months ago #19399 by VK
Hi there,
a bit late reply but I signed up to this forum only couple of days ago.

INSERT won't call your subroutine, it will only include its code at the place where you issue the INSERT (like you copy and paste it there).

Use CALL to call your subroutine, e.g.:

A subroutine:

SUBROUTINE INCR.NUM(P.NUMBER)
* increase the parameter
P.NUMBER ++
RETURN
END

Program that calls it:

a_number = 1
CALL INCR.NUM(a_number)
CRT a_number ;* output: 2

You can also use a variable with subroutine name to call it:

a_subr = 'INCR.NUM'
CALL @a_subr(a_number)

Last but not least - you don't need PGM.FILE record to do that.

Cheers
VK

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

Time to create page: 0.114 seconds