× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here's a quick example...  the MAIN keyword declares a given procedure as the main procedure (rather than a subprocedure) so when this program is CALLed, it will run the getdow procedure, and no cycle will be used.

**free
ctl-opt main(getdow);

dcl-proc getdow;

  dcl-pi *n;
    in_date char(8) const;    // input date YYYYMMDD
    out_dow packed(1: 0);     // day of week, 0=Sunday 6=Saturday
  end-pi;

  dcl-c SUNDAY const(d'1899-12-31');
  dcl-s tempDate date;
  dcl-s totalDays int(20);

  tempDate = %date(in_date:*ISO0);
  totalDays = %diff(tempDate: SUNDAY: *DAYS);
  out_dow = %rem(totalDays:7);

  return;

end-proc;


On 9/3/2019 6:10 AM, Gad Miron wrote:
Hello Guys

I need to create a callable PGM that accept a date parameter (YYYYMMDD)
and returns a DayOfWeek parameter

I've created a free format PGM alright (with Pr and PI) but I'm
stymied with making
a no-Cycle version.

I've read that using a clt- option *NOMAIN is for a Module only.

Is it possible to write such a (no cycle) program and compile it with
CRTBNDRPG in one pass
Or do I have to resort to CRTRPGMOD + CRTPGM ?

TIA
Gad

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.