Creo que es mejor con la funcion DAYOFWEEK aqui va el ejemplo:
D NDIA S 3 0
D FECHAP S D datfmt(*ISO)
D DiasData DS
D 9 Inz('DOMINGO')
D 9 Inz('LUNES')
D 9 Inz('MARTES')
D 9 Inz('MIERCOLES')
D 9 Inz('JUEVES')
D 9 Inz('VIERNES')
D 9 Inz('SABADO')
* Arreglo de Dias
D DIAS 9 DIM(7) Overlay(Diasdata)
*--------------- Proceso Principal --------------*
C *Entry Plist
C Parm Diasem 8
C MOVE *DATE FECHAP
* Actualiza la fecha en tabla DUMY
C/Exec Sql
C+ UPDATE qgpl/dumytab
C+ Set FECPRO = :FECHAP
C/End-Exec
* Recupera el numero de dia de Fecha de Proceso
C/Exec Sql
C+ SELECT dayofweek(date(FECPRO)) into :NDIA FROM QGPL/dumytab
C/End-Exec
* Asigna nombre del dia segun el numero de dia
C Eval Diasem = Dias(ndia)
Espero te sirva.
Salud2 !!
From: "Tellez Alvarado, Ignacio Andres" <[EMAIL PROTECTED]>
Reply-To: "forum.help400" <[email protected]>
To: "forum.help400" <[email protected]>
Subject: RE: API que devuelva el dia de la semana
Date: Thu, 2 Aug 2007 14:41:26 -0400
Usa callp ceedywkAqui va la descripcion y un ejemplo...Saludos=========CEEDYWKcalculate day of week from Lilian date
CEEDYWK calculates the day of the week on which a Lilian date falls. The day of the week is returned to the calling routine as a number between 1 and 7.
The number returned by CEEDYWK is useful for end-of-week calculations.
CALL CEEDYWK syntax >>-CALL--"CEEDYWK"--USING--input_Lilian_date,--output_day_no,---> >--fc.---------------------------------------------------------><
- input_Lilian_date (input)
- A 32-bit binary integer representing the Lilian date, the number of days since 14 October 1582.
For example, 16 May 1988 is day number 148138. The valid range of input_Lilian_date is between 1 and 3,074,324 (15 October 1582 and 31 December 9999).
- output_day_no (output)
- A 32-bit binary integer representing input_Lilian_date's day-of-week: 1 equals Sunday, 2 equals Monday, . . ., 7 equals Saturday.
If input_Lilian_date is invalid, output_day_no is set to 0 and CEEDYWK terminates with a non-CEE000 symbolic feedback code.
- fc (output)
- A 12-byte feedback code (optional) that indicates the result of this service.
The following symbolic conditions can result from this service:
Table 78. CEEDYWK symbolic conditions Symbolic feedback code Severity Message number Message text CEE000 0 The service completed successfully. CEE2EG 3 2512 The Lilian date value passed in a call to CEEDATE or CEEDYWK was not within the supported range. CBL LIB ************************************************ ** ** ** Function: Call CEEDYWK to calculate the ** ** day of the week from Lilian date ** ** ** ** In this example, a call is made to CEEDYWK ** ** to return the day of the week on which a ** ** Lilian date falls. (A Lilian date is the ** ** number of days since 14 October 1582) ** ** ** ************************************************ IDENTIFICATION DIVISION. PROGRAM-ID. CBLDYWK. DATA DIVISION. WORKING-STORAGE SECTION. 01 LILIAN PIC S9(9) BINARY. 01 DAYNUM PIC S9(9) BINARY. 01 IN-DATE. 02 Vstring-length PIC S9(4) BINARY. 02 Vstring-text. 03 Vstring-char PIC X, OCCURS 0 TO 256 TIMES DEPENDING ON Vstring-length of IN-DATE. 01 PICSTR. 02 Vstring-length PIC S9(4) BINARY. 02 Vstring-text. 03 Vstring-char PIC X, OCCURS 0 TO 256 TIMES DEPENDING ON Vstring-length of PICSTR. 01 FC. 02 Condition-Token-Value. COPY CEEIGZCT. 03 Case-1-Condition-ID. 04 Severity PIC S9(4) COMP. 04 Msg-No PIC S9(4) COMP. 03 Case-2-Condition-ID REDEFINES Case-1-Condition-ID. 04 Class-Code PIC S9(4) COMP. 04 Cause-Code PIC S9(4) COMP. 03 Case-Sev-Ctl PIC X. 03 Facility-ID PIC XXX. 02 I-S-Info PIC S9(9) COMP. PROCEDURE DIVISION. PARA-CBLDAYS. ** Call CEEDAYS to convert date of 6/2/88 to ** Lilian representation MOVE 6 TO Vstring-length of IN-DATE. MOVE '6/2/88' TO Vstring-text of IN-DATE(1:6). MOVE 8 TO Vstring-length of PICSTR. MOVE 'MM/DD/YY' TO Vstring-text of PICSTR(1:8). CALL 'CEEDAYS' USING IN-DATE, PICSTR, LILIAN, FC. ** If CEEDAYS runs successfully, display result. IF CEE000 of FC THEN DISPLAY Vstring-text of IN-DATE ' is Lilian day: ' LILIAN ELSE DISPLAY 'CEEDAYS failed with msg ' Msg-No of FC UPON CONSOLE STOP RUN END-IF. PARA-CBLDYWK. ** Call CEEDYWK to return the day of the week on ** which the Lilian date falls CALL 'CEEDYWK' USING LILIAN , DAYNUM , FC. ** If CEEDYWK runs successfully, print results IF CEE000 of FC THEN DISPLAY 'Lilian day ' LILIAN ' falls on day ' DAYNUM ' of the week, which is a:' ** Select DAYNUM to display the name of the day ** of the week. EVALUATE DAYNUM WHEN 1 DISPLAY 'Sunday.' WHEN 2 DISPLAY 'Monday.' WHEN 3 DISPLAY 'Tuesday' WHEN 4 DISPLAY 'Wednesday.' WHEN 5 DISPLAY 'Thursday.' WHEN 6 DISPLAY 'Friday.' WHEN 7 DISPLAY 'Saturday.' END-EVALUATE ELSE DISPLAY 'CEEDYWK failed with msg ' Msg-No of FC UPON CONSOLE STOP RUN END-IF. GOBACK.
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de [EMAIL PROTECTED]
Enviado el: Jueves, 02 de Agosto de 2007 13:22
Para: forum.help400
Asunto: Re: API que devuelva el dia de la semana
Hola Salvador:
Una API no lo se, pero con SQL dentro del RPG:
EXEC SQL
Set :DISEM = DAYOFWEEK_ISO(:FECHAPROCES);
DAYOFWEEK, devuelve 1 = Domingo .... 7 = Sábado.
DAYOFWEEK_ISO, devuelve 1=Lunes .... 7=Domingo.
Espero te sirva.
Toni Tort
Sistemes d'Informació.
Vives Vidal, Vivesa, S.A
"SALVADOR SANCHEZ COSTA" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]02/08/2007 18:34
Please respond to
"forum.help400" <[email protected]>
To<[email protected]> cc SubjectAPI que devuelva el dia de la semana
Hola,
hay alguna API que enviandole una fecha devuelva que dia de la semana es(lunes, martes, etc) ????
[IMAGE]
Salvador Sánchez Costa [IMAGE] Departamento Desarrollo
[EMAIL PROTECTED] T 968 350 011
[IMAGE]
__________________________________________________
Forum.HELP400 es un servicio m&#225;s de NEWS/400.
&#169; Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja visita la siguente URL:
http://listas.combios.es/mailman/listinfo/forum.help400
-----------------------------------------------------------------
Notice of Confidentiality: The information transmitted is intended only for the sender and person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, e-transmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender immediately by return electronic transmission and then immediately delete this transmission, including all attachments, without copying, distributing or disclosing same.
------------------------------------------------------------------
Aviso de Confidencialidad: Este correo electrónico y/o el material adjunto es para uso exclusivo del emisor y la persona o entidad a la que expresamente se le ha enviado, y puede contener información confidencial o material privilegiado. Si usted no es el destinatario legítimo del mismo, por favor repórtelo inmediatamente al remitente del correo y bórrelo.
Cualquier revisión, retransmisión, difusión o cualquier otro uso de este correo, por personas o entidades distintas a las del destinatario legítimo, queda expresamente prohibido. Este correo electrónico no pretende ni debe ser considerado como constitutivo de ninguna relación legal, contractual o de otra índole similar.
------------------------------------------------------------------
><< c.gif >>>__________________________________________________
>Forum.HELP400 es un servicio m&#225;s de NEWS/400.
>&#169; Publicaciones Help400, S.L. - Todos los derechos reservados
>http://www.help400.es
>_____________________________________________________
>
>Para darte de baja visita la siguente URL:
>http://listas.combios.es/mailman/listinfo/forum.help400
MSN Amor Busca tu ½ naranja
__________________________________________________ Forum.HELP400 es un servicio m&#225;s de NEWS/400. &#169; Publicaciones Help400, S.L. - Todos los derechos reservados http://www.help400.es _____________________________________________________
Para darte de baja visita la siguente URL: http://listas.combios.es/mailman/listinfo/forum.help400

