Micropatterns to format the date
You can insert these micropatterns in the code of a Program, a Screen, a Server, or a Macro.
Date format transformation
- The ADF micropattern transforms a date without
the century. It transforms a YYMMDD date into a date
with a separator (slash): MM/DD/YY for an English
version or DD/MM/YY for a French version. You must conform to the following input format:
*!ADF "date1 date2"
Where:- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.Note: If you press CTRL + space bar in the PDP COBOL editor, the content assist facility displays the list of the micropatterns that are adapted to the entity and to the position in the COBOL code (WORKING-STORAGE SECTION or PROCEDURE DIVISION). The micropatterns that are used only to retrieve the Pacbase data are not included in the list. Each micropattern in the list is documented. If you double-click one of them, the start tag and the identifier of the micropattern are inserted in the code. You must then complete its declaration.
- ADF is the micropattern identifier.
- " " must frame the operands.
- date1 is the initial date Data Element on six characters and date2 is the transformed date Data Element on eight characters.
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.
- The AD, AD0, AD1,
and AD2 micropatterns transform a date that is generated
in a certain format into a date that is generated in another format.You must conform to the following input format:
Where:*!ADn "xy date1 date2"
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.Note: If you press CTRL + space bar in the PDP COBOL editor, the content assist facility displays the list of the micropatterns that are adapted to the entity and to the position in the COBOL code (WORKING-STORAGE SECTION or PROCEDURE DIVISION). The micropatterns that are used only to retrieve the Pacbase data are not included in the list. Each micropattern in the list is documented. If you double-click one of them, the start tag and the identifier of the micropattern are inserted in the code. You must then complete its declaration.
- ADn is the micropattern identifier: AD, AD0, AD1 or AD2
- " " must frame the operands.
- xy are the two formats of the generated date.
The first is the initial format, whereas the second is the format
that will actually be generated.
Table 1. Correspondence between the format values and the formats of the generated dates Format values Generated formats I Year, month day (YYMMDD) D Day, month, year (DDMMYY) or
Month, day, year (MMDDYY)
according to the format type selected in the Generated date format of the Library Definition
E Day/month/year (DD/MM/YY) or
Month/day/year (MM/DD/YY)
according to the format type selected in the Generated date format of the Library Definition
These dates have an extended format.
S Century, year, month, day (CCYYMMDD) G Century year-month-day (CCYY-MM-DD) C Day, month, century, year (DDMMCCYY) or
Month, day, century year (MMDDCCYY)
according to the format type selected in the Generated date format of the Library Definition
M Day/month/century year (DD/MM/CCYY) or
Month/day/century year (MM/DD/CCYY)
according to the format type selected in the Generated date format of the Library Definition
- date1 is the initial date Data Element (you can use the DATOR constant if needed), and date2 is the transformed date Data Element. These Data Elements can be called in Segments or defined in the WORKING-STORAGE SECTION only.
These micropatterns manage the century differently:- AD transforms the date without a windowing. The century in date2 takes the value of the DAT-CTY variable, whose century value comes from CENTUR. The century is set to 19 for the Batch Applications function. However, it is set to the century of the system date for the OnLine Systems Development function, or if an ADT or ADC micropattern was indicated.
- AD0 transforms the date without a windowing. The century in date2 takes the value of the DAT-CTY, which must be added with specific code. It is set to 19.
- AD1 transforms the date with a windowing. The century in date2 is set to 19 if the year of date1 is lower that the DAT-CTYT variable. It is set to 20 otherwise. The value of DAT-CTYT is set to 61 by default.
- AD2 transforms the date with a windowing. The century in date2 is set to 20 if the year of date1 is lower that the DAT-CTYT variable. It is set to 19 otherwise. The value of DAT-CTYT is set to 61 by default.
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.
Batch date processing
You can invert a date or add slashes to it.
Micropattern identifier | Micropattern function and operands |
---|---|
ADI | Inverts the first two and the last two characters
of a six-character date. For example, YYMMDD becomes DDMMYY and
conversely. Enter:
where date1 and date2 are
both six-character date Data Elements. date2 is optional.
If it is not indicated, date1 gets the inverted date. |
ADS | Inverts a date with the century. CCYYMMDD becomes DDMMCCYY,
and conversely. Enter:
where date1 and date2 are
both eight-character date Data Elements. date2 is
optional. If it is not indicated, date1 gets the
inverted date. |
ADE | Adds slashes to a six-character date. For example, YYMMDD becomes YY/MM/DD. Enter:
where date1 is
a six-character date Data Element and date2 is an
eight-character date Data Element. |
ADM | Adds slashes to a date that includes the century.
For example CCYYMMDD becomes CCYY/MM/DD. Enter:
where date1 is
an eight-character date Data Element and date2 is
a 10-character date Data Element. |
Date computing
Micropattern identifier | Micropattern function and operands |
---|---|
DAD | Computes the number of days between two dates. Enter:
where:x the format of date1 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format. y is the format of date2 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format. The comparison result is put in NUM-DAYS field, which is automatically declared in the WORKING-STORAGE SECTION. |
DAO | Adds days to a date or subtracts days from a
date. Enter:
where:x the format of date1 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format. s is the sign(+ for an addition or - for a subtraction). number the number to be added to or subtracted from the date It can be an integer or a work area. ffnn-date1 is the input date field. |
Time processing
Micropattern identifier | Micropattern function and operands |
---|---|
TIM | Displays the time as HHMMSS from the EIBTIME
field for CICS, and the TIME field for the other
platforms. Enter:
where time1 is an optional Data
Element with a six-character format. |
TIF | Transforms the time format from HHMMSS into
HH:MM:SS. Enter:
where time1
is a Data Element with a six-character format. It represents the input date field.
time2 is an optional Data Element with an eight-character format. It represents the
field that receives the result of the time transformation. |
Generated result
- The required date fields are declared in the WORKING-STORAGE SECTION.
- The COBOL code that corresponds to the micropattern is generated after the start tag. To transform a date without century into a date with century, the CENTUR variable is used to load the century.
- The date transformation function is generated, by default in the
following subfunctions
- F9520 for the Batch Applications function. You can change the default function by entering, in the -GO lines of the Program, the DATPRO=ffss option, where ffss is the code of the function and subfunction.
- F8120 for the OnLine Systems Development or Client / Server function.