COBOLget

Packages

The list of COBOL libraries in the registry.

core-datetime Downloads: 93 Updated: January 12th Dialect: gnucobol Access: Public

GnuCOBOL core library with datetime functions

Source-code
Readme

Core Datetime

GnuCOBOL 3.x core library with datetime functions

Function Summary

Name Description
datetime-format Format the given or current timestamp, replacing the tokens, such as YY Year 18 YYYY Year 2018 M Month of the year (1-12) 7 MM Month of the year (01-12) 07 MMM Month of the year textual Jul D Day of the month (1-31) 9 DD Day of the month (01-31) 09 DDD Day of the year (01-366) 07 WW Week of the year (01-53) 05 U Weekday (1-7) 2 EEE Weekday textual Tue h Hour of the day (0-23) 5 hh Hour of the day (00-23) 05 m Minute of the hour (0-59) 9 mm Minute of the hour (00-59) 09 s Second of the minute (0-59) 4 ss Second of the minute (00-59) 04 z Timezone GMT-08:00 x Timezone ISO 8601 -08:00

Function Details

datetime-format

datetime-format(l-format, l-timestamp)

Format the given or current timestamp, replacing the tokens, such as YY Year 18 YYYY Year 2018 M Month of the year (1-12) 7 MM Month of the year (01-12) 07 MMM Month of the year textual Jul D Day of the month (1-31) 9 DD Day of the month (01-31) 09 DDD Day of the year (01-366) 07 WW Week of the year (01-53) 05 U Weekday (1-7) 2 EEE Weekday textual Tue h Hour of the day (0-23) 5 hh Hour of the day (00-23) 05 m Minute of the hour (0-59) 9 mm Minute of the hour (00-59) 09 s Second of the minute (0-59) 4 ss Second of the minute (00-59) 04 z Timezone GMT-08:00 x Timezone ISO 8601 -08:00

Parameters

l-format 32-char long string l-timestamp 21-char long current-date or ZERO

Returns

Formatted timestamp trailing by spaces, 32-char long

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add core-datetime
$ cobolget update

Install the package and its dependencies:

$ cobolget install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains complete COBOL source-code and modules.cpy Copybook ready for inclusion into your project.

core-network Downloads: 63 Updated: January 12th Dialect: gnucobol Access: Private

GnuCOBOL core library with network functions

Readme

Core Network

GnuCOBOL 3.x core library with network functions

Module Summary

Name Description
receive-udp Receive UDP requests, a UDP server @param l-host Local host name or IP address @param l-port Local port @param l-limit Limit of requests. 0 - unlimited @param l-callback Program-pointer which handles content
server-stop
receive-tcp Receive TCP requests, a TCP server @param l-host Local host name or IP address @param l-port Local port @param l-limit Limit of requests. 0 - unlimited @param l-callback Program-pointer which handles content
server-stop

Function Summary

Name Description
send-udp Send UDP datagram
syslog Prepare a message in syslog format. RFC 3164

Module Details

receive-udp

Receive UDP requests, a UDP server @param l-host Local host name or IP address @param l-port Local port @param l-limit Limit of requests. 0 - unlimited @param l-callback Program-pointer which handles content

server-stop

receive-tcp

Receive TCP requests, a TCP server @param l-host Local host name or IP address @param l-port Local port @param l-limit Limit of requests. 0 - unlimited @param l-callback Program-pointer which handles content

server-stop

Function Details

send-udp

send-udp(l-host, l-port, l-message)

Send UDP datagram

Parameters

l-host Remote host name or IP address l-port Remote port l-message Message

Returns

Number of bytes sent

syslog

syslog(l-logsource, l-program, l-facility, l-severity, l-message)

Prepare a message in syslog format. RFC 3164

Parameters

l-logsource Logsource name l-program Program name l-facility Facility code l-severity Severity code l-message String encoded in UTF-8

Returns

Syslog message

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add core-network
$ cobolget update

Install the package and its dependencies:

$ cobolget -t bca12d6c4efed0627c87f2e576b72bdb5ab88e34 install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains complete COBOL source-code and modules.cpy Copybook ready for inclusion into your project.

core-string Downloads: 57 Updated: January 12th Dialect: gnucobol Access: Public

GnuCOBOL core library with string functions

Source-code
Readme

Core String

GnuCOBOL 3.x core library with string functions

Function Summary

Name Description
substr-pos Find the position of the first occurrence of a substring in a string. Case-sensitive.
substr-pos-case Find the position of the first occurrence of a substring in a string. Case-insensitive.
byte-to-hex Convert one byte into hexadecimal representation.
hex-to-byte Convert one byte into hexadecimal representation.
substr-count Count the number of substring occurrences. Case-sensitive.
substr-count-case Count the number of substring occurrences. Case-insensitive.
sha3-256 Generate SHA3-256 message digest
sha3-512 Generate SHA3-512 message digest
urlencoded-to-byte Convert urlencoded symbol into one byte.
byte-to-urlencoded Convert one byte into urlencoded symbol.
csv-ecb-rates Convert ECB exchange rates in CSV format to the list of currency-rate pairs. https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

Function Details

substr-pos

substr-pos(l-haystack, l-needle)

Find the position of the first occurrence of a substring in a string. Case-sensitive.

Parameters

l-haystack String to search in l-needle String to search for

Returns

Position where the needle exists relative to the beginnning of l-haystack. Returns 0 if not found.

substr-pos-case

substr-pos-case(l-haystack, l-needle)

Find the position of the first occurrence of a substring in a string. Case-insensitive.

Parameters

l-haystack String to search in l-needle String to search for

Returns

Position where the needle exists relative to the beginnning of l-haystack. Returns 0 if not found.

byte-to-hex

byte-to-hex(l-byte)

Convert one byte into hexadecimal representation.

Parameters

l-byte Byte

Returns

2 hexadecimal chars

hex-to-byte

hex-to-byte(l-hex)

Convert one byte into hexadecimal representation.

Parameters

l-hex 2 hexadecimal chars

Returns

Byte

substr-count

substr-count(l-haystack, l-needle)

Count the number of substring occurrences. Case-sensitive.

Parameters

l-haystack String to search in l-needle String to search for

Returns

Number of occurrences

substr-count-case

substr-count-case(l-haystack, l-needle)

Count the number of substring occurrences. Case-insensitive.

Parameters

l-haystack String to search in l-needle String to search for

Returns

Number of occurrences

sha3-256

sha3-256(l-buffer)

Generate SHA3-256 message digest

Parameters

l-buffer Input bytes

Returns

64 hexadecimal chars

sha3-512

sha3-512(l-buffer)

Generate SHA3-512 message digest

Parameters

l-buffer Input bytes

Returns

128 hexadecimal chars

urlencoded-to-byte

urlencoded-to-byte(l-symbol)

Convert urlencoded symbol into one byte.

Parameters

l-symbol Urlencoded symbol (3 bytes)

Returns

Byte

byte-to-urlencoded

byte-to-urlencoded(l-byte)

Convert one byte into urlencoded symbol.

Parameters

l-byte Byte

Returns

Urlencoded symbol (3 bytes)

csv-ecb-rates

csv-ecb-rates(l-byte)

Convert ECB exchange rates in CSV format to the list of currency-rate pairs. https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

Parameters

l-byte CSV string

Returns

Urlencoded symbol Pointer to the list of 64 [pic x(3), pic 9(7)V9(8)] elements

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add core-string
$ cobolget update

Install the package and its dependencies:

$ cobolget install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains complete COBOL source-code and modules.cpy Copybook ready for inclusion into your project.

gcblunit Downloads: 455 Updated: September 13th Dialect: gnucobol Access: Public

Simple Unit Testing for GnuCOBOL

Readme

GCBLUnit framework

Simple Unit Testing for GnuCOBOL written in GnuCOBOL.

Features

  • Assertions
  • Reporting in JUnit format
  • Continuous Integration
  • No mainframe required
  • GnuCOBOL Docker

Requirements

You may choose between local and container execution environment.

Local

GnuCOBOL cobc 2.2+ installed.

Container

GnuCOBOL Docker container up and running. The image includes GnuCOBOL and all required dependencies needed to debug or execute your code.

Installation

Simply download gcblunit.cbl file or install by COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init
$ cobolget add --debug gcblunit
$ cobolget update
$ cobolget install
$ cobc -x -debug modules/gcblunit/gcblunit.cbl --job=-h
GCBLUnit 1.22.6  by Olegs Kunicins and contributors.

Usage:      
  cobc -x -debug gcblunit.cbl first-test.cbl [next-test.cbl] --job='first-test [next-test]'         
  cobc -x -debug gcblunit.cbl --job=Options                                     

Options:                                                                        
  -h, -help                Print this help
  -v, --version            Print the version
  --stop-on-error          Stop on the first exception
  --stop-on-failure        Stop on the first failure
  --junit report.xml       Report in JUnit XML format

Usage

$ cobc -x -debug gcblunit.cbl tests/* --job='equals-test notequals-test'
GCBLUnit 1.22.6  by Olegs Kunicins and contributors.

..............................................................

Time: 00:00:00

OK
Tests: 0000000002, Skipped: 0000000000
Assertions: 0000000062, Failures: 0000000000, Exceptions: 0000000000                                  

Writing Tests

Tests are simple COBOL programs that allow futher execution (without stop run). There is no code-generation tricks nor injections. The assertions are GnuCOBOL programs and await two values - expected and actual, respectively:

call "assert-equals" using "expected", "actual".                                

This assertion, once included into the unit-testing, will lead to one failed test. More examples you may find in the tests directory.

At the moment these assertions are supported:

  • assert-equals
  • assert-notequals

    GCBLUnit catches exceptions and stops. For instance, the statement compute y = y / 0. is getting reported this way:

GCBLUnit 1.22.6  by Olegs Kunicins and contributors.

There was an exception: EC-SIZE-OVERFLOW in exception-test; ; 33 on COMPUTE                        

Time: 00:00:00

EXCEPTIONS!
Tests: 0000000001, Skipped: 0000000000
Assertions: 0000000000, Failures: 0000000000, Exceptions: 0000000001                       

Continuous Integration

COBOLUnit returns an exit-code of the execution that is usually enough for CI pipelines. Additional details you may export to a file in JUnit XML format by using --junit option.

Alternatives

GCBLUnit primarily focuses on Unit Testing - isolated GnuCOBOL functions and programs with an input and output.

Nonetheless, you may try two alternatives as well:

  • cobol-unit-test - a paragraph-level Unit Testing framework, written by Dave Nicolette, hosted on GitHub.
  • COBOLUnit - a full-featured Unit Testing framework for COBOL, written by HervĂ© Vaujour, hosted on Google Sites. Not updated since 2010.

TODO

  • Assertion assert-greater
  • Assertion assert-less
  • Assertion assert-contains
  • Assertion assert-notcontains
  • Auto-discovery of the tests in the compilation group
  • Integration with Debugger for GnuCOBOL

Your contribution is always welcome!

main-string Downloads: 5 Updated: January 12th Dialect: entcobol Access: Public

Enterprise COBOL library with string functions

Source-code
Readme

Main String

Enterprise COBOL library with string functions

Module Summary

Name Description
strpos Find the position of the first occurrence of a substring. Case-sensitive.
stripos Find the position of the first occurrence of a substring. Case-insensitive.

Module Details

strpos

CALL "strpos" USING l-haystack, l-h-len, l-needle, l-n-len.

Find the position of the first occurrence of a substring. Case-sensitive.

Parameters

l-haystack String to search in l-h-len Size of l-haystack in bytes l-needle String to search for l-n-len Size of l-needle in bytes

Returns

Position where the needle exists relative to the beginnning of l-haystack. Returns 0 if not found.

stripos

CALL "stripos" USING l-haystack, l-h-len, l-needle, l-n-len.

Find the position of the first occurrence of a substring. Case-insensitive.

Parameters

l-haystack String to search in l-h-len Size of l-haystack in bytes l-needle String to search for l-n-len Size of l-needle in bytes

Returns

Position where the needle exists relative to the beginnning of l-haystack. Returns 0 if not found.

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add main-string
$ cobolget update

Install the package and its dependencies:

$ cobolget install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains source-code of the package and modules.cbl ready for compliation and linking with your project.

ecblunit Downloads: 18 Updated: January 16th Dialect: entcobol Access: Public

Simple Unit Testing for z/OS

Source-code
Readme

ECBLUnit tool

Simple Unit Testing for z/OS written in IBM Enterprise COBOL.

Features

  • Assertions
    • ECBLUEQ checks binary equality of two 32-byte values
    • ECBLUNEQ checks binary inequality of two 32-byte values
    • ECBLUREQ checks binary equality of two any-length values represented by pointers
  • Continuous Integration
  • Hexadecimal diff

Requirements

  • z/OS 6.2+ account
  • Zowe command-line interface

z/OS account

Obtain an access to a mainframe for training purposes, free of charge. Register at IBM and follow the instructions. You'll receive a registration email with USER ID e.g. Z82698, IP address e.g. 192.86.32.250 and PORT e.g. 10443. For generating the password, you need to login on Open Mainframe Project Slack workspace. After logging in add zih app via Apps menu and post zih a message e.g. Hi. The app will ask your e-mail address and userid that you have received. Post these details one by one and the app will create your PASSWORD for the next step.

Zowe CLI

Zowe is an open-source framework that allows teams to manage, control, script, and develop on the mainframe, a part of the Open Mainframe Project. Zowe provides a Command-Line Interface that lets you interact with the mainframe from your machine.

$ npm i -g @zowe/cli --ignore-scripts

Create Zowe default ztrial profile by using your z/OS credentials and setting the --reject-unauthorized flag to false that bypasses the certificate requirement:

$ zowe profiles create zosmf ztrial --host  --port  --user  --pass  --reject-unauthorized false
Profile created successfully!

Verify that your profile can communicate with z/OSMF:

$ zowe zosmf check status

Installation

Simply download ecblunit.cbl file or install by COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init
$ cobolget add --debug ecblunit
$ cobolget update
$ cobolget install

Usage

Upload the files to the mainframe and submit a JCL job which compiles and links them together. Executable ECBLUNIT awaits a list of test programs in PARM parameter, separated by space.

$ zowe zos-files upload file-to-data-set src/ecblunit.cbl .CBL
$ zowe zos-files upload file-to-data-set tests/tests.cbl .CBL
$ zowe jobs submit local-file tests/tests.jcl --view-all-spool-content
...
 ECBLUnit 1.64.8 by Olegs Kunicins and contributors.

 Time: 00:00:00
 OK
 Tests: 003, Skipped: 000
 Assertions: 050, Failures: 000, Exceptions: 000

Writing Tests

Tests are simple COBOL programs that allow further execution (without STOP RUN). There is no code-generation tricks nor injections. The assertions are COBOL programs and await two PIC X(32) values - expected and actual, respectively:

CALL "ECBLUEQ" USING expected actual.
CALL "ECBLUNEQ" USING expected actual.

The record-equality assertion awaits two POINTER values providing flexible comparison of any data at any position:

CALL "ECBLUREQ" USING
    BY CONTENT ADDRESS OF expected
    BY CONTENT ADDRESS OF actual
    BY CONTENT LENGTH OF expected.

More examples you may find in the tests/tests.cbl file.

Continuous Integration

ECBLUnit returns RETURN-CODE of the execution that is usually enough for CI pipelines. Here's an one-liner which picks the exit code from the output, on Linux:

zowe jobs submit local-file tests/tests.jcl --wait-for-output --rff retcode --rft string | cut -d" " -f 2

Alternatives

ECBLUnit primarily focuses on Unit Testing - isolated COBOL programs and methods with an input and output.

Nonetheless, you may try two alternatives as well:

  • cobol-unit-test - a paragraph-level Unit Testing framework, written by Dave Nicolette, hosted on GitHub.
  • zUnit - a commercial framework on the IBM mainframe platform.

TODO

  • Reporting in JUnit format
  • Catch exceptions and stops

Your contribution is always welcome!

main-bitwise Downloads: 1 Updated: January 12th Dialect: entcobol Access: Private

Enterprise COBOL library with bitwise functions

Readme

Main Bitwise

Enterprise COBOL library with bitwise functions

Module Summary

Name Description
BOR Bitwise OR
BAND Bitwise AND
BXOR Bitwise XOR
BNOT Bitwise NOT

Module Details

BOR

CALL "BOR" USING l-arg-a, l-arg-b.

Bitwise OR

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

BAND

CALL "BAND" USING l-arg-a, l-arg-b.

Bitwise AND

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

BXOR

CALL "BXOR" USING l-arg-a, l-arg-b.

Bitwise XOR

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

BNOT

CALL "BNOT" USING l-arg-a, l-arg-b.

Bitwise NOT

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add main-bitwise
$ cobolget update

Install the package and its dependencies:

$ cobolget -t bca12d6c4efed0627c87f2e576b72bdb5ab88e34 install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains source-code of the package and modules.cbl ready for compliation and linking with your project.

Documentation

See coboldoc documentation.

fuji-bitwise Downloads: 1 Updated: February 11th Dialect: netcobol Access: Public

NetCOBOL library with bitwise functions

Source-code
Readme

Fuji Bitwise

NetCOBOL library with bitwise functions

Module Summary

Name Description
byte-to-hex Convert one byte into hexadecimal representation.
hex-to-byte Convert hexadecimal to binary.
byte-to-bin Convert one byte into binary representation.
bin-or Bitwise OR
bin-and Bitwise AND
bin-xor Bitwise XOR
bin-not Bitwise NOT

Module Details

byte-to-hex

CALL "byte-to-hex" USING l-byte.

Convert one byte into hexadecimal representation.

Parameters

l-byte Byte

Returns

2 hexadecimal chars

hex-to-byte

CALL "hex-to-byte" USING l-hex.

Convert hexadecimal to binary.

Parameters

l-hex 2 hexadecimal chars

Returns

Byte

byte-to-bin

CALL "byte-to-bin" USING l-byte.

Convert one byte into binary representation.

Parameters

l-byte Byte

Returns

8 binary chars

bin-or

CALL "bin-or" USING l-arg-a, l-arg-b.

Bitwise OR

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

bin-and

CALL "bin-and" USING l-arg-a, l-arg-b.

Bitwise AND

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

bin-xor

CALL "bin-xor" USING l-arg-a, l-arg-b.

Bitwise XOR

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

bin-not

CALL "bin-not" USING l-arg-a, l-arg-b.

Bitwise NOT

Parameters

l-arg-a One byte l-arg-b One byte

Returns

One byte

Usage

Install and initialize COBOL Package Manager:

$ npm install -g cobolget
$ cobolget init

Add the package to the Manifest:

$ cobolget add fuji-bitwise
$ cobolget update

Install the package and its dependencies:

$ cobolget install
....
Modules modules.cpy and modules.cbl updated.

Directory modules contains source-code of the package and modules.cbl ready for compliation and linking with your project.

demo-banking-lae1983 Downloads: 0 Updated: March 13th Dialect: gnucobol Access: Public

Demo banking package

Source-code
Readme

Demo

My first GnuCOBOL library with banking functions

iban-checksum

Calculate IBAN checksum

  • @param l-iban IBAN string
  • @return '1' in case of success
© COBOLget 2021 · Packages · Terms · Privacy