IBM Support

How to convert a date to a julian date formatted CYYDDD (SCI87036)

Question & Answer


Question

How to convert a date to a julian date formatted CYYDDD (SCI87036)

Cause

Answer

Using the following sample Extended Rule:

string [3] sCentury,sYear, sDay,tmpDay;
String [7] tempstrdate, converteddate;

sCentury = "";
sYear = "";
sDay = "";
tempstrdate = "";
tmpDay = "00";

strdate(#OrderDate,"%Y%j",tempstrdate);

sCentury = Left (tempstrdate,2);
sYear = mid(tempstrdate,2,2);
sDay = mid(tempstrdate,4,3);

if sCentury = "20" then sCentury = "1";
if sCentury = "19" then sCentury = "0";

if len(sDay) = 1 then tmpDay = tmpDay + sDay;
else if len(sDay) = 2 then tmpDay = Left(tmpDay,1) + sDay;
else tmpDay = sDay;

converteddate = sCentury + sYear + tmpDay;
$Dummy.#Dummy = ATOI(converteddate);

[{"Product":{"code":"SS6UP7","label":"Sterling Gentran:Director"},"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Component":"Mapping and Translation","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB02","label":"AI Applications"}},{"Product":{"code":"SS3JSW","label":"Sterling B2B Integrator"},"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Component":"Mapping and Translation","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB02","label":"AI Applications"}},{"Product":{"code":"SS6V5U","label":"Sterling Gentran:Server for UNIX"},"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Component":"Mapping and Translation","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SS6V3G","label":"Sterling Gentran:Server for Microsoft Windows"},"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Component":"Mapping and Translation","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

Historical Number

PRI9589

Product Synonym

[<p><b>]Fact[</b><p>];[<p>]Gentran:Server for Windows, All Releases [<br />] Gentran Integration Suite,
all Releases [<br />] Gentran:Server for UNIX, Release 6.0 [<br />] Gentran:Server
for UNIX, Release 6.1 [<br />] Gentran:Director for Windows, All Releases [<br />]
SCI87036 [<br />] Map Editor [<br />] Extended Rules[</p>];[<p><b>]Goal[</b><p>];[<p>]How to convert a date to a Julian date formatted CYYDDD[</p>]

Document Information

Modified date:
14 November 2019

UID

swg21544762