ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/apiexusdata.htm

153 lines
7.1 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Examples: Using ILE Common Execution Environment data APIs" />
<meta name="abstract" content="These examples show how to call the ILE Common Execution Environment (CEE) data APIs for ILE COBOL and ILE RPG." />
<meta name="description" content="These examples show how to call the ILE Common Execution Environment (CEE) data APIs for ILE COBOL and ILE RPG." />
<meta name="DC.Relation" scheme="URI" content="apiexmp.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="apiexusdata" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Examples: Using ILE Common Execution Environment data APIs</title>
</head>
<body id="apiexusdata"><a name="apiexusdata"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples: Using ILE Common Execution Environment data APIs</h1>
<div><p>These examples show how to call the ILE Common Execution
Environment (CEE) data APIs for ILE COBOL and ILE RPG.</p>
<div class="section"><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for important
legal information.</div>
<pre> PROCESS NOMONOPRC.
************************************************************
*
* This sample ILE COBOL program demonstrates how to call the
* Common Execution Environment (CEE) Date APIs. The program
* accepts two parameters. The first is the date in character
* form and the second the format of the date. For instance
* CALL CEEDATES ('10131955' 'MMDDYYYY') causes the program
* to treat the date as October 13 1955).
*
* The program then displays on the console the numeric day of
* the week for that date (Sunday = 1) and the named day of
* week for that date.
*
************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CEEDATES.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
LINKAGE TYPE PROCEDURE FOR "CEEDAYS" USING ALL DESCRIBED,
LINKAGE TYPE PROCEDURE FOR "CEEDYWK" USING ALL DESCRIBED,
LINKAGE TYPE PROCEDURE FOR "CEEDATE" USING ALL DESCRIBED.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Lilian-Date PIC S9(9) BINARY.
01 Day-of-Week-Numeric PIC S9(9) BINARY.
01 Day-of-Week-Alpha PIC X(10).
01 Day-of-Week-Format PIC X(10) VALUE "Wwwwwwwwwz".
LINKAGE SECTION.
01 Sample-Date PIC X(8).
01 Date-Format PIC X(8).
PROCEDURE DIVISION USING Sample-Date, Date-Format.
SAMPLE.
*
* Convert formatted date to Lilian date
*
CALL "CEEDAYS" USING Sample-Date
Date-Format
Lilian-Date
OMITTED.
*
* Get numeric day of week from Lilian date
*
CALL "CEEDYWK" USING Lilian-Date
Day-of-Week-Numeric
OMITTED.
*
* Get day of week from Lilian date
*
CALL "CEEDATE" USING Lilian-Date
Day-of-Week-Format
Day-of-Week-Alpha
OMITTED.
DISPLAY "Day of week = " Day-of-Week-Numeric UPON CONSOLE.
DISPLAY "Day of week = " Day-of-Week-Alpha UPON CONSOLE.
STOP RUN.</pre>
<pre> D************************************************************
D*
D* This sample ILE RPG program demonstrates how to call the
D* Common Execution Environment (CEE) Date APIs. The program
D* accepts two parameters. The first is the date in character
D* form and the second the format of the date. For instance
D* CALL CEEDATES ('10131955' 'MMDDYYYY') causes the program
D* to treat the date as October 13 1955).
D*
D* The program must be compiled with DFTACTGRP(*NO)
D*
D* The program then displays on the console the numeric day of
D* the week for that date (Sunday = 1) and the named day of
D* week for that date.
D*
D************************************************************
DLilianDate s 10i 0
DDayOfWkN s 10i 0
DDayOfWkA s 10
DDayOfWkFmt s 10 inz('Wwwwwwwwwz')
C *entry plist
C parm SampleDate 8
C parm DateFormat 8
C*
C* Convert formatted date to Lilian date
C*
C callb(d) 'CEEDAYS'
C parm SampleDate
C parm DateFormat
C parm LilianDate
C parm *OMIT
C*
C* Get numeric day of week from Lilian date
C*
C callb(d) 'CEEDYWK'
C parm LilianDate
C parm DayOfWkN
C parm *OMIT
C*
C* Get day of week from Lilian date
C*
C callb(d) 'CEEDATE'
C parm LilianDate
C parm DayOfWkFmt
C parm DayOfWkA
C parm *OMIT
C*
C DayOfWkN dsply
C DayOfWkA dsply
C eval *inlr = '1'
C return</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="apiexmp.htm" title="Contains example programs that use APIs and exit programs.">Examples: APIs</a></div>
</div>
</div>
</body>
</html>