Pointer variable in COBOL is a special type of variable. In this post I am sharing what is pointer variable, how to initialize and use them.
What are pointers
Another extension of the USAGE clause is to define data items that contain addresses of data or procedures.
POINTER is a four-byte data item that holds the address of another data item. PROCEDURE-POINTER is a four- or eight-byte data item (depending on the operating system) that contains the address of a program-entry point.
Rules for Pointer Variables
- A POINTER data item cannot have a PICTURE clause.
- The figurative constant NULL (or NULLS) can be used to initialise POINTER and PROCEDURE-POINTER data. No other literal value can be assigned to POINTER data.
In addition to the new data types, vendors implement special registers for use with address data:
ADDRESS OF a register that exists for each record (level 01 or 77) in the Linkage Section of the Data Division. The contents are the address of the data item, for example, ADDRESS OF record.
LENGTH OF a register that contains the length in bytes of the named data item, for example, LENGTH OF identifier.
POINTER variable you cannot use in a MOVE statement. They are manipulated by an extension of the SET statement that assigns them values.
SET identifier-1 TO ADDRESS OF identifier-2
where identifier-1 is a POINTER data item and identifer-2 is any data item in the Working-Storage Section or Linkage Section.
- POINTER data items can be used in relation conditions (to test for equality) and as arguments in a CALL statement.
- PROCEDURE-POINTER data items can be used as the object of a CALL statement.
-
Secure S3 File Upload Using API Gateway, Lambda & PostgreSQL (Complete AWS Architecture Guide
Modern applications often allow users to upload files—documents, invoices, images, or datasets. But a production-grade upload pipeline must be secure, scalable, and well-organized. In this article, we will build a complete end-to-end architecture where: We will implement this using Amazon API Gateway, AWS Lambda, PostgreSQL, and Amazon S3. This architecture is widely used in cloud-native…
-
AI Agents in Data Engineering: Everything You Need to Know
AI agents are revolutionizing data engineering by automating tasks such as monitoring pipelines, generating SQL queries, and ensuring data quality. They enhance productivity, speed up troubleshooting, and improve data accessibility for users. While offering significant advantages, AI agents also face challenges in security, accuracy, and integration with existing systems.
-
The End-to-End AI Stack – A Real Guide for Developers to Code, Create, and Execute
Artificial Intelligence tools are on the rise, from writing assistants to coding helpers and automation platforms. However, many professionals struggle to compare these tools effectively. This is where the AI Stack becomes important. Modern AI tools like ChatGPT, NotebookLM, and Antigravity serve different purposes, and understanding their roles helps in: Layer 1: Conversational AI (Thinking…







One response
[…] are data items that contain virtual storage addresses. You define them either explicitly with the USAGE IS POINTER clause in the DATA DIVISION or implicitly as ADDRESS OF special […]
LikeLike