Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

User defined functions

$
0
0

Hello,

I know it possible to define functions in a repository :

mytest.cbl

     $set preservecase case
       identification division.
       program-id. mytest.
       environment division.
       repository.
           function MYFUNCTION.
       data division.
       ...
       procedure division.
           move function myfunction(myparameter) to myresult
      .........
      end program mytest.

And then myfunction.cbl :

      $set repository(update ON) preservecase case
       function-id. myfunction,
       ....
       linkage section.
       1 myparam ....
       1 myresult .....
       procedure division using myparam returning myresult
       .......
      end function myfunction.

But we have two separate source files.

Is it possible to create embedded functions in a cobol program ?

Like we have

program-id. a.
  call "b" using myparam, myresult
  goback.
  program-id. b.
  linkage section.
  1 myparam ....
  1 myresult .....
  procedure division using myparam myresult    
     do something
      goback.
  end program b.
end program a.


which would give :

program-id. a.
  move function b(myparam) to myresult
  goback.

  function-id. b.
  linkage section.
  1 myparam ....
  1 myresult .....
  procedure division using myparam returning myresult
     do something
     goback.
  end function b.
end program a.


Regards,


Alain


Viewing all articles
Browse latest Browse all 4356

Trending Articles