× 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.



Gad, you've received many useful (and varied!) approaches to your two questions.

However, you originally asked, "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 ?"

The simple answers are "YES" and "NO". Scott provided a working example that you can compile with CRTBNDRPG. No *SRVPGM, *BNDDIR, SQL, etc. required! I've plagiarised Scott's example a little, (see below); compile with CRTBNDRPG and call from the command line:

**free
ctl-opt main(getdow);

dcl-proc getdow;

  dcl-pi *n;
    in_date char(8) const;    // input date YYYYMMDD
  end-pi;

  dcl-c SUNDAY const(d'1899-12-31');
  dcl-s tempDate date;
  dcl-s totalDays int(20);
  dcl-s out_dow packed(1: 0);     // day of week, 0=Sunday 6=Saturday
  dcl-s UserId char(10) inz(*User);

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

  dsply out_dow UserId;

  return;

end-proc;

HTH,
Brian.

On 04/09/2019 09:32, Gad Miron wrote:
Hello guys

Thanks to Robert, Carel, Dexter , Justin, Raul for your input.

To sum it:
1. This is a small exercise so I do not want to use SQL although it seems
the simplest way.
2. I thing I understand that creating a module/procedure and embed it in a
SRVPGM is
the proper way to do it
but
3. I hazily recall from years back having read that upon the first call of
a module/procedure
of a service program the entire SRVPGM is loaded into memory .
(and since we have several big SRVPGMs I don't want to add this routine
to any of them)

Am I wrong about this loading of entire SRVPGM into memory?


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.