WeixiangYan/CodeTransOcean huggingface dataset:
Task: Call a function




Go: import (
	"image"
	"image/gif"
	"io/ioutil"
	"strings"
	"unicode"
)

func f() (int, float64)  { return 0, 0 }
func g(int, float64) int { return 0 }
func h(string, ...int)   {}






COBOL: CALL "No-Arguments"


CALL "2-Arguments" USING Foo Bar

CALL "Optional-Arguments" USING Foo
CALL "Optional-Arguments" USING Foo Bar


CALL "Optional-Arguments" USING Foo OMITTED Bar



CALL "2-Arguments" USING Foo






CALL "Some-Func" USING Foo
MOVE Return-Code TO Bar






MOVE FUNCTION PI TO Bar
MOVE FUNCTION MEDIAN(4, 5, 6) TO Bar







CALL "C$MAKEDIR" USING Foo
CALL "CBL_CREATE_DIR" USING Foo
CALL "CBL_OC_NANOSLEEP" USING Bar

CALL X"F4" USING Foo Bar
 










CALL "Modify-Arg" USING BY REFERENCE Foo 
CALL "Modify-Arg" USING BY CONTENT Foo   
CALL "C-Func" USING BY VALUE Bar






ACCEPT Foo 
CALL "Use-Func" USING Foo
CALL Foo USING Bar
Task: Include a file




Go: 
package main

import "fmt"

func hello() {
    fmt.Println("Hello from main.go")
}

func main() {
    hello()
    hello2()
}






COBOL: COPY "copy.cpy". 
COPY "another-copy.cpy" REPLACING foo BY bar
                                  SPACE BY ZERO
                                  ==text to replace== BY ==replacement text==.
Task: String comparison




Go: package main

import (
    "fmt"
    "strings"
)

func main() {
    
    c := "cat"
    d := "dog"
    if c == d {
        fmt.Println(c, "is bytewise identical to", d)
    }
    if c != d {
        fmt.Println(c, "is bytewise different from", d)
    }
    if c > d {
        fmt.Println(c, "is lexically bytewise greater than", d)
    }
    if c < d {
        fmt.Println(c, "is lexically bytewise less than", d)
    }
    if c >= d {
        fmt.Println(c, "is lexically bytewise greater than or equal to", d)
    }
    if c <= d {
        fmt.Println(c, "is lexically bytewise less than or equal to", d)
    }
    
    

    
    
    eqf := `when interpreted as UTF-8 and compared under Unicode
simple case folding rules.`
    if strings.EqualFold(c, d) {
        fmt.Println(c, "equal to", d, eqf)
    } else {
        fmt.Println(c, "not equal to", d, eqf)
    }

    
    
    
    
    
    
    
}






COBOL: "hello" = "hello"   
"helloo" <> "hello" 
"aello" < "hello"
Task: Two identical strings





Java: public class TwoIdenticalStrings {
    public static void main(String[] args) {
        System.out.println("Decimal Binary");
        for (int i = 0; i < 1_000; i++) {
            String binStr = Integer.toBinaryString(i);
            if (binStr.length() % 2 == 0) {
                int len = binStr.length() / 2;
                if (binStr.substring(0, len).equals(binStr.substring(len))) {
                    System.out.printf("%7d %s%n", i, binStr);
                }
            }
        }
    }
}





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID.  IDENTICAL-STRINGS.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 VARIABLES.
          03 INPUT-NUMBER            PIC 9(4).
          03 BINARY-REPRESENTATION   PIC 9(10).
          03 BIT                     REDEFINES BINARY-REPRESENTATION,
                                     PIC 9 OCCURS 10 TIMES.
          03 FIRST-SET-BIT           PIC 99.
          03 CURRENT-BIT             PIC 99.
          03 SECOND-BIT              PIC 99.
          03 BIT-VALUE               PIC 9(4).
          03 OUTPUT-NUMBER           PIC 9(4) VALUE ZERO.
          03 REMAINING-BITS          PIC 9(4)V9.
          03 FILLER                  REDEFINES REMAINING-BITS.
             05 REST                 PIC 9(4).
             05 FILLER               PIC 9.
                88 BIT-IS-SET        VALUE 5.

       01 OUTPUT-FORMAT.
          03 DECIMAL-OUTPUT          PIC Z(3)9.
          03 BINARY-OUTPUT           PIC Z(9)9.

       PROCEDURE DIVISION.
       BEGIN.
           PERFORM IDENTICAL-STRING
               VARYING INPUT-NUMBER FROM 1 BY 1
               UNTIL OUTPUT-NUMBER IS GREATER THAN 1000.
           STOP RUN.

       IDENTICAL-STRING.
           MOVE ZERO TO BINARY-REPRESENTATION.
           MOVE 10 TO CURRENT-BIT.
           MOVE INPUT-NUMBER TO REMAINING-BITS.
           PERFORM EXTRACT-BIT UNTIL REMAINING-BITS EQUAL ZERO.
           MOVE CURRENT-BIT TO FIRST-SET-BIT.
           MOVE 10 TO SECOND-BIT.
           PERFORM COPY-BIT UNTIL SECOND-BIT IS EQUAL TO FIRST-SET-BIT.
           MOVE ZERO TO OUTPUT-NUMBER.
           IF CURRENT-BIT IS EQUAL TO ZERO, MOVE 1 TO CURRENT-BIT.
           PERFORM INSERT-BIT
               VARYING CURRENT-BIT FROM CURRENT-BIT BY 1
               UNTIL CURRENT-BIT IS GREATER THAN 10.
           MOVE OUTPUT-NUMBER TO DECIMAL-OUTPUT.
           MOVE BINARY-REPRESENTATION TO BINARY-OUTPUT.
           IF OUTPUT-NUMBER IS LESS THAN 1000,
               DISPLAY DECIMAL-OUTPUT ": " BINARY-OUTPUT.

       EXTRACT-BIT.
           DIVIDE 2 INTO REMAINING-BITS.
           IF BIT-IS-SET, MOVE 1 TO BIT(CURRENT-BIT).
           SUBTRACT 1 FROM CURRENT-BIT.
           MOVE REST TO REMAINING-BITS.

       COPY-BIT.
           MOVE BIT(SECOND-BIT) TO BIT(CURRENT-BIT).
           SUBTRACT 1 FROM SECOND-BIT.
           SUBTRACT 1 FROM CURRENT-BIT.

       INSERT-BIT.
           COMPUTE BIT-VALUE = 2 ** (10 - CURRENT-BIT)
           MULTIPLY BIT(CURRENT-BIT) BY BIT-VALUE.
           ADD BIT-VALUE TO OUTPUT-NUMBER.
Task: Call a foreign-language function





Java: public class JNIDemo
{
  static
  {  System.loadLibrary("JNIDemo");  }
  
  public static void main(String[] args)
  {
    System.out.println(callStrdup("Hello World!"));
  }
  
  private static native String callStrdup(String s);
}





COBOL:        identification division.
       program-id. foreign.

       data division.
       working-storage section.
       01 hello.
          05 value z"Hello, world".
       01 duplicate    usage pointer.
       01 buffer       pic x(16) based.
       01 storage      pic x(16).

       procedure division.
       call "strdup" using hello returning duplicate
           on exception
               display "error calling strdup" upon syserr
       end-call
       if duplicate equal null then
           display "strdup returned null" upon syserr
       else
           set address of buffer to duplicate
           string buffer delimited by low-value into storage
           display function trim(storage)
           call "free" using by value duplicate
               on exception
                   display "error calling free" upon syserr
       end-if
       goback.
Task: Disarium numbers





Java: import java.lang.Math;

public class DisariumNumbers {
    public static boolean is_disarium(int num) {
        int n = num;
        int len = Integer.toString(n).length();
        int sum = 0;
        int i = 1;
        while (n > 0) {
            sum += Math.pow(n % 10, len - i + 1);
            n /= 10;
            i ++;
        }
        return sum  == num;
    }

    public static void main(String[] args) {
        int i = 0;
        int count = 0;
        while (count <= 18) {
            if (is_disarium(i)) {
                System.out.printf("%d ", i);
                count++;
            }
            i++;
        }
        System.out.printf("%s", "\n");
    }
}





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. DISARIUM.
       
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 VARIABLES.
          03 CANDIDATE     PIC 9(9).
          03 DIGITS        PIC 9 OCCURS 9 TIMES, REDEFINES CANDIDATE.
          03 IDX           PIC 99.
          03 EXPONENT      PIC 99.
          03 DGT-POWER     PIC 9(9).
          03 DGT-POWER-SUM PIC 9(9).
          03 CAND-OUT      PIC Z(8)9.
          03 AMOUNT        PIC 99 VALUE 18.
          
       PROCEDURE DIVISION.
       BEGIN.
           PERFORM DISARIUM-TEST VARYING CANDIDATE FROM ZERO BY 1
           UNTIL AMOUNT IS ZERO.
           STOP RUN.
        
       DISARIUM-TEST.
           MOVE ZERO TO DGT-POWER-SUM.
           MOVE 1 TO EXPONENT, IDX.
           INSPECT CANDIDATE TALLYING IDX FOR LEADING ZEROES.
           PERFORM ADD-DIGIT-POWER UNTIL IDX IS GREATER THAN 9.
           IF DGT-POWER-SUM IS EQUAL TO CANDIDATE,
               MOVE CANDIDATE TO CAND-OUT,
               DISPLAY CAND-OUT,
               SUBTRACT 1 FROM AMOUNT.
           
       ADD-DIGIT-POWER.
           COMPUTE DGT-POWER = DIGITS(IDX) ** EXPONENT.
           ADD DGT-POWER TO DGT-POWER-SUM.
           ADD 1 TO EXPONENT.
           ADD 1 TO IDX.
Task: Flow-control structures





Java: switch (xx) {
  case 1:
  case 2:
    
    ...
    break;
  case 4:
    
    ...
    break;
  case 5:
    
    ...
    break;
  default:
    
    break;
}

for (int i = 0; i < 10; ++i) {
  ...
  if (some_condition) { break; }
  ...
}

_Time_: do {
  for (int i = 0; i < 10; ++i) {
    ...
    if (some_condition) { break _Time_; }
    ...
    }
  ...
} while (thisCondition);





COBOL:        PROGRAM-ID. Go-To-Example.

       PROCEDURE DIVISION.
       Foo.
           DISPLAY "Just a reminder: GO TOs are evil."

           GO TO Foo
           .
Task: Substring_Top and tail





Java: String strOrig = 'brooms';
String str1 = strOrig.substring(1, strOrig.length());
system.debug(str1);
String str2 = strOrig.substring(0, strOrig.length()-1);
system.debug(str2);
String str3 = strOrig.substring(1, strOrig.length()-1);
system.debug(str3);


String strOrig = 'brooms';
String str1 = strOrig.replaceAll( '^.', '' );
system.debug(str1);
String str2 = strOrig.replaceAll( '.$', '' ) ;
system.debug(str2);
String str3 = strOrig.replaceAll( '^.|.$', '' );
system.debug(str3);





COBOL:        identification division.
       program-id. toptail.

       data division.
       working-storage section.
       01 data-field.
          05 value "[this is a test]".

       procedure division.
       sample-main.
       display data-field
      
       display data-field(2:)
       display data-field(1:length of data-field - 1)
       display data-field(2:length of data-field - 2)
       goback.
       end program toptail.
Task: Boolean values





Java: module GeorgeBoole
    {
    @Inject Console console;

    void run()
        {
        Boolean f = False;
        assert !f == True;

        
        
        assert True.and(False) == True & False == False;
        assert True.or(False)  == True | False == True;
        assert True.xor(False) == True ^ False == True;
        assert True.not() == ~True == False;

        console.print($"0==1 = {0==1}");
        console.print($"!False = {!False}");
        }
    }





COBOL:        01  some-bool               PIC 1 BIT.
Task: Hello world_Line printer





Java: import java.io.FileWriter;
import java.io.IOException;
 
public class LinePrinter {
  public static void main(String[] args) {
    try {
      FileWriter lp0 = new FileWriter("/dev/lp0");
      lp0.write("Hello World!");
      lp0.close();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }
}





COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD-PRINTER.

PROCEDURE DIVISION.
DISPLAY 'Hello World!'
	UPON PRINTER
END-DISPLAY.
STOP RUN.
Task: Call a function





Java: foo();             
Int x = bar();     





COBOL: CALL "No-Arguments"


CALL "2-Arguments" USING Foo Bar

CALL "Optional-Arguments" USING Foo
CALL "Optional-Arguments" USING Foo Bar


CALL "Optional-Arguments" USING Foo OMITTED Bar



CALL "2-Arguments" USING Foo






CALL "Some-Func" USING Foo
MOVE Return-Code TO Bar






MOVE FUNCTION PI TO Bar
MOVE FUNCTION MEDIAN(4, 5, 6) TO Bar







CALL "C$MAKEDIR" USING Foo
CALL "CBL_CREATE_DIR" USING Foo
CALL "CBL_OC_NANOSLEEP" USING Bar

CALL X"F4" USING Foo Bar
 










CALL "Modify-Arg" USING BY REFERENCE Foo 
CALL "Modify-Arg" USING BY CONTENT Foo   
CALL "C-Func" USING BY VALUE Bar






ACCEPT Foo 
CALL "Use-Func" USING Foo
CALL Foo USING Bar
Task: Copy a string





Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);









COBOL: MOVE "Hello" TO src
MOVE src TO dst
Task: Include a file





Java: public class Class1 extends Class2
{
	
}





COBOL: COPY "copy.cpy". 
COPY "another-copy.cpy" REPLACING foo BY bar
                                  SPACE BY ZERO
                                  ==text to replace== BY ==replacement text==.
Task: Two identical strings








VB: Imports System.Console
Module Module1
  Sub Main()
    Dim p, c, k, lmt as integer : p = 2 : lmt = 1000
    For n As Integer = 1 to lmt
      p += If(n >= p, p, 0) : k = n + n * p
      If k > lmt Then Exit For Else c += 1
      Write("{0,3} ({1,-10})  {2}", k, Convert.ToString( k, 2),
          If(c Mod 5 = 0, vbLf, ""))
    Next : WriteLine(vbLf + "Found {0} numbers whose base 2 representation is the concatenation of two identical binary strings.", c)
  End Sub
End Module


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID.  IDENTICAL-STRINGS.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 VARIABLES.
          03 INPUT-NUMBER            PIC 9(4).
          03 BINARY-REPRESENTATION   PIC 9(10).
          03 BIT                     REDEFINES BINARY-REPRESENTATION,
                                     PIC 9 OCCURS 10 TIMES.
          03 FIRST-SET-BIT           PIC 99.
          03 CURRENT-BIT             PIC 99.
          03 SECOND-BIT              PIC 99.
          03 BIT-VALUE               PIC 9(4).
          03 OUTPUT-NUMBER           PIC 9(4) VALUE ZERO.
          03 REMAINING-BITS          PIC 9(4)V9.
          03 FILLER                  REDEFINES REMAINING-BITS.
             05 REST                 PIC 9(4).
             05 FILLER               PIC 9.
                88 BIT-IS-SET        VALUE 5.

       01 OUTPUT-FORMAT.
          03 DECIMAL-OUTPUT          PIC Z(3)9.
          03 BINARY-OUTPUT           PIC Z(9)9.

       PROCEDURE DIVISION.
       BEGIN.
           PERFORM IDENTICAL-STRING
               VARYING INPUT-NUMBER FROM 1 BY 1
               UNTIL OUTPUT-NUMBER IS GREATER THAN 1000.
           STOP RUN.

       IDENTICAL-STRING.
           MOVE ZERO TO BINARY-REPRESENTATION.
           MOVE 10 TO CURRENT-BIT.
           MOVE INPUT-NUMBER TO REMAINING-BITS.
           PERFORM EXTRACT-BIT UNTIL REMAINING-BITS EQUAL ZERO.
           MOVE CURRENT-BIT TO FIRST-SET-BIT.
           MOVE 10 TO SECOND-BIT.
           PERFORM COPY-BIT UNTIL SECOND-BIT IS EQUAL TO FIRST-SET-BIT.
           MOVE ZERO TO OUTPUT-NUMBER.
           IF CURRENT-BIT IS EQUAL TO ZERO, MOVE 1 TO CURRENT-BIT.
           PERFORM INSERT-BIT
               VARYING CURRENT-BIT FROM CURRENT-BIT BY 1
               UNTIL CURRENT-BIT IS GREATER THAN 10.
           MOVE OUTPUT-NUMBER TO DECIMAL-OUTPUT.
           MOVE BINARY-REPRESENTATION TO BINARY-OUTPUT.
           IF OUTPUT-NUMBER IS LESS THAN 1000,
               DISPLAY DECIMAL-OUTPUT ": " BINARY-OUTPUT.

       EXTRACT-BIT.
           DIVIDE 2 INTO REMAINING-BITS.
           IF BIT-IS-SET, MOVE 1 TO BIT(CURRENT-BIT).
           SUBTRACT 1 FROM CURRENT-BIT.
           MOVE REST TO REMAINING-BITS.

       COPY-BIT.
           MOVE BIT(SECOND-BIT) TO BIT(CURRENT-BIT).
           SUBTRACT 1 FROM SECOND-BIT.
           SUBTRACT 1 FROM CURRENT-BIT.

       INSERT-BIT.
           COMPUTE BIT-VALUE = 2 ** (10 - CURRENT-BIT)
           MULTIPLY BIT(CURRENT-BIT) BY BIT-VALUE.
           ADD BIT-VALUE TO OUTPUT-NUMBER.
Task: Call a foreign-language function








VB:   Declare Function CreateFileW Lib "Kernel32" (FileName As WString, DesiredAccess As Integer, ShareMode As Integer, SecurityAttributes As Integer, _
        CreateDisposition As Integer, Flags As Integer, Template As Integer) As Integer
  Declare Function WriteFile Lib "Kernel32" (fHandle As Integer, writeData As Ptr, numOfBytes As Integer, ByRef numOfBytesWritten As Integer, _
        overlapped As Ptr) As Boolean
  Declare Function GetLastError Lib "Kernel32" () As Integer
  Declare Function CloseHandle Lib "kernel32" (hObject As Integer) As Boolean
  
  Const FILE_SHARE_READ = &h00000001
  Const FILE_SHARE_WRITE = &h00000002
  Const OPEN_EXISTING = 3
  
  Dim fHandle As Integer = CreateFileW("C:\foo.txt", 0,  FILE_SHARE_READ Or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0)
  If fHandle > 0 Then
    Dim mb As MemoryBlock = "Hello, World!"
    Dim bytesWritten As Integer
    If Not WriteFile(fHandle, mb, mb.Size, bytesWritten, Nil) Then
      MsgBox("Error Number: " + Str(GetLastError))
    End If
    Call CloseHandle(fHandle)
  Else
    MsgBox("Error Number: " + Str(GetLastError))
  End If


COBOL:        identification division.
       program-id. foreign.

       data division.
       working-storage section.
       01 hello.
          05 value z"Hello, world".
       01 duplicate    usage pointer.
       01 buffer       pic x(16) based.
       01 storage      pic x(16).

       procedure division.
       call "strdup" using hello returning duplicate
           on exception
               display "error calling strdup" upon syserr
       end-call
       if duplicate equal null then
           display "strdup returned null" upon syserr
       else
           set address of buffer to duplicate
           string buffer delimited by low-value into storage
           display function trim(storage)
           call "free" using by value duplicate
               on exception
                   display "error calling free" upon syserr
       end-if
       goback.
Task: Flow-control structures








VB:   Sub bar2()
      Dim x = 0
      GoTo label
      x = 5
label:
      Console.WriteLine(x)
  End Sub


COBOL:        PROGRAM-ID. Go-To-Example.

       PROCEDURE DIVISION.
       Foo.
           DISPLAY "Just a reminder: GO TOs are evil."

           GO TO Foo
           .
Task: Return multiple values








VB: Type Contact
    Name As String
    firstname As String
    Age As Byte
End Type

Function SetContact(N As String, Fn As String, A As Byte) As Contact
    SetContact.Name = N
    SetContact.firstname = Fn
    SetContact.Age = A
End Function


Sub Test_SetContact()
Dim Cont As Contact

    Cont = SetContact("SMITH", "John", 23)
    Debug.Print Cont.Name & " " & Cont.firstname & ", " & Cont.Age & " years old."
End Sub


COBOL:        identification division.
       program-id. multiple-values.

       environment division.
       configuration section.
       repository.
           function multiples
           function all intrinsic.

       REPLACE ==:linked-items:== BY ==
       01 a usage binary-long.
       01 b pic x(10).
       01 c usage float-short.
       ==
       ==:record-item:== BY ==
       01 master.
          05 ma usage binary-long.
          05 mb pic x(10).
          05 mc usage float-short.
       ==.

       data division.
       working-storage section.
       :linked-items:

       :record-item:
       
       procedure division.
       sample-main.

       move 41 to a
       move "aaaaabbbbb" to b
       move function e to c

       display "Original: " a ", " b ", " c
       call "subprogram" using a b c
       display "Modified: " a ", " b ", " c
       
       move multiples() to master
       display "Multiple: " ma ", " mb ", " mc

       goback.
       end program multiple-values.

      
       identification division.
       program-id. subprogram.

       data division.
       linkage section.
       :linked-items:

       procedure division using a b c.
       add 1 to a
       inspect b converting "a" to "b"
       divide 2 into c
       goback.
       end program subprogram.

      
       identification division.
       function-id. multiples.

       data division.
       linkage section.
       :record-item:

       procedure division returning master.
       move 84 to ma
       move "multiple" to mb
       move function pi to mc
       goback.
       end function multiples.
Task: Substring_Top and tail








VB: string = "Small Basic"
TextWindow.WriteLine(Text.GetSubTextToEnd(string, 2)) 
TextWindow.WriteLine(Text.GetSubText(string, 1, Text.GetLength(string) - 1)) 
TextWindow.WriteLine(Text.GetSubText(string, 2, Text.GetLength(string) - 2)) 


COBOL:        identification division.
       program-id. toptail.

       data division.
       working-storage section.
       01 data-field.
          05 value "[this is a test]".

       procedure division.
       sample-main.
       display data-field
      
       display data-field(2:)
       display data-field(1:length of data-field - 1)
       display data-field(2:length of data-field - 2)
       goback.
       end program toptail.
Task: Boolean values








VB: Dim a As Integer
Dim b As Boolean
Debug.Print b
a = b
Debug.Print a
b = True
Debug.Print b
a = b
Debug.Print a


COBOL:        01  some-bool               PIC 1 BIT.
Task: Call a function








VB: 


Function no_arguments() As String
    no_arguments = "ok"
End Function


Function fixed_number(argument1 As Integer, argument2 As Integer)
    fixed_number = argument1 + argument2
End Function


Function optional_parameter(Optional argument1 = 1) As Integer
    
    optional_parameter = argument1
End Function


Function variable_number(arguments As Variant) As Integer
    variable_number = UBound(arguments)
End Function


Function named_arguments(argument1 As Integer, argument2 As Integer) As Integer
    named_arguments = argument1 + argument2
End Function


Function statement() As String
    Debug.Print "function called as statement"
    statement = "ok"
End Function





Function return_value() As String
    return_value = "ok"
End Function






Sub foo()
    Debug.Print "subroutine",
End Sub

Function bar() As String
    bar = "function"
End Function


Function passed_by_value(ByVal s As String) As String
    s = "written over"
    passed_by_value = "passed by value"
End Function

Function passed_by_reference(ByRef s As String) As String
    s = "written over"
    passed_by_reference = "passed by reference"
End Function





Sub no_parentheses(myargument As String)
    Debug.Print myargument,
End Sub


Public Sub calling_a_function()
    
    Debug.Print "no arguments", , no_arguments
    Debug.Print "no arguments", , no_arguments()
    
    
    
    Debug.Print "fixed_number", , fixed_number(1, 1)
    
    
    Debug.Print "optional parameter", optional_parameter
    Debug.Print "optional parameter", optional_parameter(2)
    
    
    Debug.Print "variable number", variable_number([{"hello", "there"}])
    
    
    
    Debug.Print "named arguments", named_arguments(argument2:=1, argument1:=1)
    
    
    statement
    
    
    s = "no_arguments"
    Debug.Print "first-class context", Application.Run(s)
    
    
    
    returnvalue = return_value
    Debug.Print "obtained return value", returnvalue
    
    
    
    
    foo
    Debug.Print , bar
    
    
    Dim t As String
    t = "unaltered"
    Debug.Print passed_by_value(t), t
    Debug.Print passed_by_reference(t), t
    
    
    
    
    
    no_parentheses "calling a subroutine"
    Debug.Print "does not require parentheses"
    Call no_parentheses("deprecated use")
    Debug.Print "of parentheses"
    
End Sub


COBOL: CALL "No-Arguments"


CALL "2-Arguments" USING Foo Bar

CALL "Optional-Arguments" USING Foo
CALL "Optional-Arguments" USING Foo Bar


CALL "Optional-Arguments" USING Foo OMITTED Bar



CALL "2-Arguments" USING Foo






CALL "Some-Func" USING Foo
MOVE Return-Code TO Bar






MOVE FUNCTION PI TO Bar
MOVE FUNCTION MEDIAN(4, 5, 6) TO Bar







CALL "C$MAKEDIR" USING Foo
CALL "CBL_CREATE_DIR" USING Foo
CALL "CBL_OC_NANOSLEEP" USING Bar

CALL X"F4" USING Foo Bar
 










CALL "Modify-Arg" USING BY REFERENCE Foo 
CALL "Modify-Arg" USING BY CONTENT Foo   
CALL "C-Func" USING BY VALUE Bar






ACCEPT Foo 
CALL "Use-Func" USING Foo
CALL Foo USING Bar
Task: Copy a string








VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub


COBOL: MOVE "Hello" TO src
MOVE src TO dst