Home > Archive > Cobol > September 2005 > fonction current-date
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
fonction current-date
|
|
| Gérard 2005-09-22, 6:55 pm |
| Je débute en COBOL et je dois mettre la date dans mon programme au format
jjmmaaaa en utilisant la fonction current-date.
Dois je mettre cette fonction dans lexique dans screen section ou procédure
division.
Merci d'avance
Alex
| |
|
| In article <n1AYe.36336$hV3.16626@nntpserver.swip.net>,
Gérard <gerard.gley@tele2.fr> wrote:
>Je débute en COBOL et je dois mettre la date dans mon programme au format
>jjmmaaaa en utilisant la fonction current-date.
>Dois je mettre cette fonction dans lexique dans screen section ou procédure
>division.
>Merci d'avance
La fonction CURRENT-DATE donne ce format: AAAAMMJJ.
<http://publibz.boulder.ibm.com/cgi-...6&CASE=&FS=TRUE>
DD
| |
| Chuck Stevens 2005-09-22, 6:55 pm |
|
"Gérard" <gerard.gley@tele2.fr> wrote in message
news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
> Je débute en COBOL et je dois mettre la date dans mon programme au format
> jjmmaaaa en utilisant la fonction current-date.
> Dois je mettre cette fonction dans lexique dans screen section ou
procédure
> division.
> Merci d'avance
>
> Alex
Courtesy of http://world.altavista.com/tr, I get "I begin in COBOL and I
must put the date in my program at the format jjmmaaaa by using the function
current-date. Must I put this function in lexicon in screen section or
procedure division."
Function CURRENT-DATE, for all compilers that support it, is coded in the
PROCEDURE DIVISION and need not be mentioned elsewhere. It needs a place to
put its returned information; the full response to this function is 21
characters but eight is sufficient. However, the calendar portion of the
response is in the format aaaammjj; as the (admittedly remote) possibility
of getting different dates for successive executions of the function does
exist, I would suggest calling the function once to provide a sending field
in the format aaaammjj, and then using reference modification and the STRING
statement to rearrange the information into a different destination.
This program seems to work in my ANSI-85 COBOL environment:
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 INDATE PIC X(8).
77 OUTDATE PIC X(8).
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
MOVE FUNCTION CURRENT-DATE TO INDATE.
DISPLAY INDATE.
STRING INDATE (7:2), INDATE (5:2), INDATE (1:4)
DELIMITED BY SIZE
INTO OUTDATE.
DISPLAY OUTDATE.
STOP RUN.
There are other ways to accomplish this -- the function can go into a group
that has the year, month and day fields defined, and another group can have
the same field names, allowing you to use MOVE CORRESPONDING., for example.
The way I chose seemed to me clearer and more straightforward, although
there may be ways that are less processor-intensive in one or another
implementation.
To forestall potential attacks by Certain Curmudgeons in this group, I'd
suggest *next* time dig a little deeper into your class materials before
asking others to do the Hard Part of your homework ... ;-)
-Chuck Stevens
| |
|
| In article <dgujg4$2ol5$1@si05.rsvl.unisys.com>,
Chuck Stevens <charles.stevens@unisys.com> wrote:
>
>"Gérard" <gerard.gley@tele2.fr> wrote in message
>news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
>procédure
>
>Courtesy of http://world.altavista.com/tr, I get "I begin in COBOL and I
>must put the date in my program at the format jjmmaaaa by using the function
>current-date. Must I put this function in lexicon in screen section or
>procedure division."
[snip]
>To forestall potential attacks by Certain Curmudgeons in this group, I'd
>suggest *next* time dig a little deeper into your class materials before
>asking others to do the Hard Part of your homework ... ;-)
Courtesy of http://babelfish.altavista.com:
--begin quoted text:
Pour devancer des attaques de potentiel par Certain Curmudgeons dans ce
groupe, je suggérerais * après * la fouille de temps plus profond dans vos
matériaux de classe avant de demander d'autres pour faire la partie dure
de votre travail... ; -)
--end quoted text
Mais non, mon tres cher fromage du chevre... c'est rien!
DD
| |
| Oliver Wong 2005-09-22, 6:55 pm |
|
"Chuck Stevens" <charles.stevens@unisys.com> wrote in message
news:dgujg4$2ol5$1@si05.rsvl.unisys.com...
>
> "Gérard" <gerard.gley@tele2.fr> wrote in message
> news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
> procédure
>
> Courtesy of http://world.altavista.com/tr, I get "I begin in COBOL and I
> must put the date in my program at the format jjmmaaaa by using the
> function
> current-date. Must I put this function in lexicon in screen section or
> procedure division."
As a person who speaks French, I claim this is essentially a correct
translation, with perhaps the minor addition that "jjmmaaaa" could be
translated to "ddmmyyyy".
- Oliver
| |
| Oliver Wong 2005-09-22, 6:55 pm |
| "Chuck Stevens" <charles.stevens@unisys.com> wrote in message
news:dgujg4$2ol5$1@si05.rsvl.unisys.com...
>
> "Gérard" <gerard.gley@tele2.fr> wrote in message
> news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
Alex,
je ne suis pas un "pro", ni en COBOL ni en francais, mais au cas ou vous
ne comprenez pas l'anglais, voici mon essai pour une traduction du reponse
de Chuck Stevens (aussi, je n'ai pas de clavier francais, allors y'a pas
d'accent dans mon message):
[color=darkred]
> Function CURRENT-DATE, for all compilers that support it, is coded in the
> PROCEDURE DIVISION and need not be mentioned elsewhere. It needs a place
> to
> put its returned information; the full response to this function is 21
> characters but eight is sufficient. However, the calendar portion of the
> response is in the format aaaammjj; as the (admittedly remote) possibility
> of getting different dates for successive executions of the function does
> exist, I would suggest calling the function once to provide a sending
> field
> in the format aaaammjj, and then using reference modification and the
> STRING
> statement to rearrange the information into a different destination.
>
> This program seems to work in my ANSI-85 COBOL environment:
La fonction CURREN-DATE, pour les compilateurs qui la supportent, dois etre
ecrit dans la PROCEDURE DIVISION et n'a pas besoin d'etre mentionee ailleur.
Elle at besoin d'une location pour metre l'information qu'elle retourne. La
valeur retourne par cette fonction mesure 21 lettre, mais 8 est suffisant.
Par contre, la portion calendriere de la reponse est dans la format
"aaaammjj". Comme il y a une risque que la fonction peut retourner deux
valeur different si on l'appelle deux fois, je suggere que vous appelez la
fonction une fois, sauve-gardez la valleur dans le format aaaammjj, et
utilizez "reference modification" et le commande STRING pour rearranger
l'information dans une autre destination.
Cette programme marche dans mon environment de ANSI-85 COBOL:
> IDENTIFICATION DIVISION.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 77 INDATE PIC X(8).
> 77 OUTDATE PIC X(8).
> PROCEDURE DIVISION.
> MAIN-PARAGRAPH.
> MOVE FUNCTION CURRENT-DATE TO INDATE.
> DISPLAY INDATE.
> STRING INDATE (7:2), INDATE (5:2), INDATE (1:4)
> DELIMITED BY SIZE
> INTO OUTDATE.
> DISPLAY OUTDATE.
> STOP RUN.
> There are other ways to accomplish this -- the function can go into a
> group
> that has the year, month and day fields defined, and another group can
> have
> the same field names, allowing you to use MOVE CORRESPONDING., for
> example.
> The way I chose seemed to me clearer and more straightforward, although
> there may be ways that are less processor-intensive in one or another
> implementation.
Il y a d'autre methode pour accomplir la meme choise -- l'information du
fonction peut etre mis dans un "group" qui a l'anne, le mois et le jour
defini dans des "fields" individuelles, et un autre group peut avoir les
meme fields. Ainsi, vous pouvez utilize MOVE CORRESPONDING pour copier
l'information de l'un group a l'autre. La maniere que j'ai choisi semblait
etre plus clair, mais il peut exister d'autre implementations qui
besoindront moin the temp sur le processeur.
> To forestall potential attacks by Certain Curmudgeons in this group, I'd
> suggest *next* time dig a little deeper into your class materials before
> asking others to do the Hard Part of your homework ... ;-)
Pour eviter le risque d'un attack par les Avares de cette groupe, je suggere
que la prochaine fois, vous feriez un peu plus de recherches dans vos notes
de lecture avant de demander d'autre a fair vos devoirs pour vous.
- Oliver
| |
| William M. Klein 2005-09-22, 6:55 pm |
| Ignoring the fact that my French isn't good enough to handle this reply.
Chuck (for additional information)
I *believe* that an '02 conforming compiler with support for the Screen
Section, *must* support the Intrinsic Function Current-Date in a FROM field in
the (processor dependent) Screen Section (just as they must support in as a
Source in the Report Section - which is NOT processor dependent).
However, unless reference modification were used, then it would not come in in
the "correct format".
It is my impression that some, but not all, compilers that do support intrinsic
functions AND (as an extension to the '85 Standard) Screen Section, already
support functions there in a FROM clause (but not, of course, in a USING clause)
--
Bill Klein
wmklein <at> ix.netcom.com
"Chuck Stevens" <charles.stevens@unisys.com> wrote in message
news:dgujg4$2ol5$1@si05.rsvl.unisys.com...
>
> "Gérard" <gerard.gley@tele2.fr> wrote in message
> news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
> procédure
>
> Courtesy of http://world.altavista.com/tr, I get "I begin in COBOL and I
> must put the date in my program at the format jjmmaaaa by using the function
> current-date. Must I put this function in lexicon in screen section or
> procedure division."
>
> Function CURRENT-DATE, for all compilers that support it, is coded in the
> PROCEDURE DIVISION and need not be mentioned elsewhere. It needs a place to
> put its returned information; the full response to this function is 21
> characters but eight is sufficient. However, the calendar portion of the
> response is in the format aaaammjj; as the (admittedly remote) possibility
> of getting different dates for successive executions of the function does
> exist, I would suggest calling the function once to provide a sending field
> in the format aaaammjj, and then using reference modification and the STRING
> statement to rearrange the information into a different destination.
>
> This program seems to work in my ANSI-85 COBOL environment:
>
> IDENTIFICATION DIVISION.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 77 INDATE PIC X(8).
> 77 OUTDATE PIC X(8).
> PROCEDURE DIVISION.
> MAIN-PARAGRAPH.
> MOVE FUNCTION CURRENT-DATE TO INDATE.
> DISPLAY INDATE.
> STRING INDATE (7:2), INDATE (5:2), INDATE (1:4)
> DELIMITED BY SIZE
> INTO OUTDATE.
> DISPLAY OUTDATE.
> STOP RUN.
>
> There are other ways to accomplish this -- the function can go into a group
> that has the year, month and day fields defined, and another group can have
> the same field names, allowing you to use MOVE CORRESPONDING., for example.
> The way I chose seemed to me clearer and more straightforward, although
> there may be ways that are less processor-intensive in one or another
> implementation.
>
> To forestall potential attacks by Certain Curmudgeons in this group, I'd
> suggest *next* time dig a little deeper into your class materials before
> asking others to do the Hard Part of your homework ... ;-)
>
> -Chuck Stevens
>
>
| |
| Chuck Stevens 2005-09-22, 6:55 pm |
| Well, I've heard of people being addressed as little cabbages, but not as
goat cheese ...
Alas, my French is pretty much limited to the motto from Chateau
Mouton-Rothschild, some lines from a chorus (or should I say *the* chorus)
from "La Grande-Duchesse du Gerolstein" and a few snippets from Carmen's
chorus parts, and a parentally-induced cringe every time I see (or hear)
"chaise lounge", so I'm not sure exactly what it is that's nothing! ;-)
Some other languages I do rather better at ...
-Chuck Stevens
<docdwarf@panix.com> wrote in message news:dgukvu$l2f$1@reader1.panix.com...
> In article <dgujg4$2ol5$1@si05.rsvl.unisys.com>,
> Chuck Stevens <charles.stevens@unisys.com> wrote:
format[color=darkred]
function[color=darkred]
>
> [snip]
>
>
> Courtesy of http://babelfish.altavista.com:
>
> --begin quoted text:
>
> Pour devancer des attaques de potentiel par Certain Curmudgeons dans ce
> groupe, je suggérerais * après * la fouille de temps plus profond dans vos
> matériaux de classe avant de demander d'autres pour faire la partie dure
> de votre travail... ; -)
>
> --end quoted text
>
> Mais non, mon tres cher fromage du chevre... c'est rien!
>
> DD
>
| |
| howard.brazee@cusys.edu 2005-09-22, 6:55 pm |
| On Thu, 22 Sep 2005 16:17:28 GMT, "Oliver Wong" <owong@castortech.com>
wrote:
>
> As a person who speaks French, I claim this is essentially a correct
>translation, with perhaps the minor addition that "jjmmaaaa" could be
>translated to "ddmmyyyy".
I inferred that, but it reminded me of all of those movie Mexicans who
can speak English pretty well, but have never learned how to say "yes"
or "mister".
| |
| Gérard 2005-09-22, 6:55 pm |
| Thank you
Alex
<docdwarf@panix.com> a écrit dans le message de news:
dguj15$n9j$1@reader1.panix.com...
> In article <n1AYe.36336$hV3.16626@nntpserver.swip.net>,
> Gérard <gerard.gley@tele2.fr> wrote:
procédure[color=darkred]
>
> La fonction CURRENT-DATE donne ce format: AAAAMMJJ.
>
>
<http://publibz.boulder.ibm.com/cgi-...gy3pg10/1.3.8.5
..2?SHELF=&DT=20020923143836&CASE=&FS=TRUE>
>
> DD
>
| |
| Gérard 2005-09-22, 6:55 pm |
| Thank you
Alex
<docdwarf@panix.com> a écrit dans le message de news:
dguj15$n9j$1@reader1.panix.com...
> In article <n1AYe.36336$hV3.16626@nntpserver.swip.net>,
> Gérard <gerard.gley@tele2.fr> wrote:
procédure[color=darkred]
>
> La fonction CURRENT-DATE donne ce format: AAAAMMJJ.
>
>
<http://publibz.boulder.ibm.com/cgi-...gy3pg10/1.3.8.5
..2?SHELF=&DT=20020923143836&CASE=&FS=TRUE>
>
> DD
>
| |
| Gérard 2005-09-22, 6:55 pm |
| IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 INDATE PIC X(8).
77 OUTDATE PIC X(8).
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
MOVE FUNCTION CURRENT-DATE TO INDATE.
DISPLAY INDATE.
STRING INDATE (7:2), INDATE (5:2), INDATE (1:4)
DELIMITED BY SIZE
INTO OUTDATE.
DISPLAY OUTDATE.
STOP RUN.
Alex
"Chuck Stevens" <charles.stevens@unisys.com> a écrit dans le message de
news: dgujg4$2ol5$1@si05.rsvl.unisys.com...
>
> "Gérard" <gerard.gley@tele2.fr> wrote in message
> news:n1AYe.36336$hV3.16626@nntpserver.swip.net...
format[color=darkred]
> procédure
>
> Courtesy of http://world.altavista.com/tr, I get "I begin in COBOL and I
> must put the date in my program at the format jjmmaaaa by using the
function
> current-date. Must I put this function in lexicon in screen section or
> procedure division."
>
> Function CURRENT-DATE, for all compilers that support it, is coded in the
> PROCEDURE DIVISION and need not be mentioned elsewhere. It needs a place
to
> put its returned information; the full response to this function is 21
> characters but eight is sufficient. However, the calendar portion of the
> response is in the format aaaammjj; as the (admittedly remote) possibility
> of getting different dates for successive executions of the function does
> exist, I would suggest calling the function once to provide a sending
field
> in the format aaaammjj, and then using reference modification and the
STRING
> statement to rearrange the information into a different destination.
>
> This program seems to work in my ANSI-85 COBOL environment:
>
> IDENTIFICATION DIVISION.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 77 INDATE PIC X(8).
> 77 OUTDATE PIC X(8).
> PROCEDURE DIVISION.
> MAIN-PARAGRAPH.
> MOVE FUNCTION CURRENT-DATE TO INDATE.
> DISPLAY INDATE.
> STRING INDATE (7:2), INDATE (5:2), INDATE (1:4)
> DELIMITED BY SIZE
> INTO OUTDATE.
> DISPLAY OUTDATE.
> STOP RUN.
>
> There are other ways to accomplish this -- the function can go into a
group
> that has the year, month and day fields defined, and another group can
have
> the same field names, allowing you to use MOVE CORRESPONDING., for
example.
> The way I chose seemed to me clearer and more straightforward, although
> there may be ways that are less processor-intensive in one or another
> implementation.
>
> To forestall potential attacks by Certain Curmudgeons in this group, I'd
> suggest *next* time dig a little deeper into your class materials before
> asking others to do the Hard Part of your homework ... ;-)
>
> -Chuck Stevens
>
>
| |
| Gérard 2005-09-22, 6:55 pm |
| Thank you
Alex
"Oliver Wong" <owong@castortech.com> a écrit dans le message de news:
70BYe.244401$9A2.3525@edtnps89...
> "Chuck Stevens" <charles.stevens@unisys.com> wrote in message
> news:dgujg4$2ol5$1@si05.rsvl.unisys.com...
format[color=darkred]
>
> Alex,
>
> je ne suis pas un "pro", ni en COBOL ni en francais, mais au cas ou
vous
> ne comprenez pas l'anglais, voici mon essai pour une traduction du reponse
> de Chuck Stevens (aussi, je n'ai pas de clavier francais, allors y'a pas
> d'accent dans mon message):
>
the[color=darkred]
place[color=darkred]
the[color=darkred]
possibility[color=darkred]
does[color=darkred]
>
> La fonction CURREN-DATE, pour les compilateurs qui la supportent, dois
etre
> ecrit dans la PROCEDURE DIVISION et n'a pas besoin d'etre mentionee
ailleur.
> Elle at besoin d'une location pour metre l'information qu'elle retourne.
La
> valeur retourne par cette fonction mesure 21 lettre, mais 8 est suffisant.
> Par contre, la portion calendriere de la reponse est dans la format
> "aaaammjj". Comme il y a une risque que la fonction peut retourner deux
> valeur different si on l'appelle deux fois, je suggere que vous appelez la
> fonction une fois, sauve-gardez la valleur dans le format aaaammjj, et
> utilizez "reference modification" et le commande STRING pour rearranger
> l'information dans une autre destination.
>
> Cette programme marche dans mon environment de ANSI-85 COBOL:
>
>
>
> Il y a d'autre methode pour accomplir la meme choise -- l'information du
> fonction peut etre mis dans un "group" qui a l'anne, le mois et le jour
> defini dans des "fields" individuelles, et un autre group peut avoir les
> meme fields. Ainsi, vous pouvez utilize MOVE CORRESPONDING pour copier
> l'information de l'un group a l'autre. La maniere que j'ai choisi semblait
> etre plus clair, mais il peut exister d'autre implementations qui
> besoindront moin the temp sur le processeur.
>
>
> Pour eviter le risque d'un attack par les Avares de cette groupe, je
suggere
> que la prochaine fois, vous feriez un peu plus de recherches dans vos
notes
> de lecture avant de demander d'autre a fair vos devoirs pour vous.
>
> - Oliver
>
>
| |
| Gérard 2005-09-22, 6:55 pm |
| Thank You
Alex
"William M. Klein" <wmklein@nospam.netcom.com> a écrit dans le message de
news: CoBYe.141$1v5.8@fe03.news.easynews.com...
> Ignoring the fact that my French isn't good enough to handle this reply.
>
> Chuck (for additional information)
> I *believe* that an '02 conforming compiler with support for the Screen
> Section, *must* support the Intrinsic Function Current-Date in a FROM
field in
> the (processor dependent) Screen Section (just as they must support in as
a
> Source in the Report Section - which is NOT processor dependent).
>
> However, unless reference modification were used, then it would not come
in in
> the "correct format".
>
> It is my impression that some, but not all, compilers that do support
intrinsic
> functions AND (as an extension to the '85 Standard) Screen Section,
already
> support functions there in a FROM clause (but not, of course, in a USING
clause)
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "Chuck Stevens" <charles.stevens@unisys.com> wrote in message
> news:dgujg4$2ol5$1@si05.rsvl.unisys.com...
format[color=darkred]
function[color=darkred]
the[color=darkred]
place to[color=darkred]
the[color=darkred]
possibility[color=darkred]
does[color=darkred]
field[color=darkred]
STRING[color=darkred]
group[color=darkred]
have[color=darkred]
example.[color=darkred]
>
>
|
|
|
|
|