Re: time() in z/OS XL C with LP64 (AMODE 64) --> bug?

2007-05-07 Thread Don Poitras
Michel,
   Odd. Yes, I'm running IBM C. Also 1.8. You should probably open
an ETR. Perhaps your installation is in error.

> Hi Don,
> 
> As I told in my first posting:
> In batch & AMODE 31, the following program works fine:
> 
> #include /* for date and time functions */
> #include/* for printf()*/
> 
> int main(void)
> {
> time_t ctime;
> struct tm *ptr_to_struct;
> 
> ctime = 0;/* retrieve the UNIX epoch*/
> ptr_to_struct = gmtime(&ctime);
> printf("\"(1) %s\"", asctime(ptr_to_struct));
> ctime = time(NULL);   /* retrieve the current calendar time */
> ptr_to_struct = localtime(&ctime);
> printf("\"(2) %s\"", asctime(ptr_to_struct));
> return 0;
> }
> 
> In batch & AMODE 31, printf() displays:
> --
> "(1) Thu Jan  1 00:00:00 1970
> ""(2) Mon May  7 14:38:10 2007
> "
> (O.K. because asktime() returns a string which includes NL)
> 
> In batch & AMODE 64, the result is:
> --
> "(1) Thu Jan  1 00:00:00 1970
> followed by:
> IEF450I ARCIS1X GO STEP1 - ABEND=S000 U4087 REASON=0007
> i.e. calling gmtime() is successful but the call of time() fails.
> 
> Since you compiled and executed your program in USS, I now performed the
> following tests:
> 
> In UNIX & AMODE 31:
> --
> IBMUSER:/u/arcis: >c99 -o timepgm time.c
> IBMUSER:/u/arcis: >timepgm
> "(1) Thu Jan  1 00:00:00 1970
> ""(2) Mon May  7 07:49:44 2007
> "IBMUSER:/u/arcis: >
> (O.K.)
> 
> BUT in UNIX & AMODE 64:
> --
> IBMUSER:/u/arcis: >c99 -Wc,LP64 -Wl,LP64 -o timepgm time.c
> IBMUSER:/u/arcis: >timepgm
> 
>   83951656  Killed  ./timepgm
> IBMUSER:/u/arcis: >
> i.e. even worse than in batch!
> There is no single printf() output!
> 
> Just to be sure, I added #define __Posix1a in time.c, but the result is the
> same:
> IBMUSER:/u/arcis: >oedit time.c
> IBMUSER:/u/arcis: >c99 -Wc,LP64 -Wl,LP64 -o timepgm time.c
> IBMUSER:/u/arcis: >timepgm
> 
>   67174442  Killed  ./timepgm
> IBMUSER:/u/arcis: >
> 
> In summary:
> - in batch & AMODE 64, only time() fails;
> - in USS & AMODE 64, the entire program fails.
> 
> TIA for additional comments/suggestions.
> 
> BTW, just to be sure: you made your test using IBM's z/OS XL C, or did you
> use SAS/C?
> 
> Regards,
> 
> Michel Castelein
> --
> Michel Castelein - Arcis Services
> MVS-OS/390-z/OS system engineer & instructor
> arcis[at]advalvas[dot]be
> http://www.geocities.com/michelcastelein/


-- 
Don Poitras - zSeries R & D  -  SAS Institute Inc. -  SAS Campus Drive 
mailto:[EMAIL PROTECTED]   (919)531-5637  Fax:677- Cary, NC 27513

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: time() in z/OS XL C with LP64 (AMODE 64) --> bug?

2007-05-06 Thread Don Poitras
In article <[EMAIL PROTECTED]> you wrote:
> Using the C compiler of z/OS XL C/C++ V1.8:

> In AMODE 31, calling time() to retieve the current calendar time works fine.

> However, when compiling with the LP64 option, the compilation and binding 
> are OK, but the program execution results in an ABEND U4087 with reason code 
> 7, while running LE-module CELQLIB.
> ABEND U4087 indicates that an error during error processing (i.e. a 
> recursive error) was detected.

> I wonder if someone else experienced the same problem.
> Is it a (documented) bug?

> TIA for the feedback.

Works for me:

/u/sasdtp: >cat time.c
#define __Posix1a
#include 
#include 
#include 
#include 

int main()
{
time_t theTime;
struct tm *lcltime;
char msg_str[80];

theTime = time(NULL);
lcltime = localtime(&theTime);
strftime(msg_str, 80, "Local time is %m.%d.%Y %H:%M:%S",lcltime);
printf("%.80s\n", msg_str);

return 0;
}
/u/sasdtp: >c89 -Wc,LP64 -Wl,LP64 -o time time.c   
/u/sasdtp: >./time
Local time is 05.06.2007 17:35:33


> Michel Castelein

> --
> Michel Castelein - Arcis Services
> MVS-OS/390-z/OS system engineer & instructor
> arcis[at]advalvas[dot]be
> http://www.geocities.com/michelcastelein/ 



-- 
Don Poitras - SAS Development  -  SAS Institute Inc. - SAS Campus Drive
[EMAIL PROTECTED]   (919) 531-5637Cary, NC 27513

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html