|
From: G?rard on 22 Sep 2005 11:25 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
From: on 22 Sep 2005 11:36 In article <n1AYe.36336$hV3.16626(a)nntpserver.swip.net>, G?rard <gerard.gley(a)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-bin/bookmgr_OS390/BOOKS/igy3pg10/1.3.8.5.2?SHELF=&DT=20020923143836&CASE=&FS=TRUE> DD
From: Chuck Stevens on 22 Sep 2005 11:45 "G?rard" <gerard.gley(a)tele2.fr> wrote in message news:n1AYe.36336$hV3.16626(a)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
From: on 22 Sep 2005 12:09 In article <dgujg4$2ol5$1(a)si05.rsvl.unisys.com>, Chuck Stevens <charles.stevens(a)unisys.com> wrote: > >"G?rard" <gerard.gley(a)tele2.fr> wrote in message >news:n1AYe.36336$hV3.16626(a)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." [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
From: Oliver Wong on 22 Sep 2005 12:17
"Chuck Stevens" <charles.stevens(a)unisys.com> wrote in message news:dgujg4$2ol5$1(a)si05.rsvl.unisys.com... > > "G?rard" <gerard.gley(a)tele2.fr> wrote in message > news:n1AYe.36336$hV3.16626(a)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." 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 |