Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

000002 \"FREE FI (indd)\" 800003 /* 000004 \"ALLOC FI indd DA ZOS. PUBLIC. P3.SY

ID: 3868578 • Letter: 0

Question

000002 "FREE FI (indd)" 800003 /* 000004 "ALLOC FI indd DA ZOS. PUBLIC. P3.SYSLOG) SHR REUSE 800005 /* 000006 "EXECIO 0 DISKR indd (OPEN 808007 /* 000008 "EXECIO DISKR indd (STEM sysrec. FINIS" 000009 iee252i count- 000010 clrscn 800011 do i-1 to sysrec.b 000012 msgid = substr (susrec. 1,58,8) 000013 select 000014 when msgid 000015 when msgid 000016 when msgid 000817 otherwise nop 000018 end 000019 end 000020 "FREE FI (indd)" 800821 say 008022 say Number of IPL parameter PDS members = 'IEE2521' then call IEE2521 IEA371I' then call IEA371I I0S128I' then call I0S128I iee252i count

Explanation / Answer

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

#define ERR (-1)
#define TRUE 1
#define FALSE 0

int main();

int main(argc, argv)
int argc;
char *argv[];

{
int isdevice = FALSE;
struct stat stat_buf;

if (argc != 2)
{
printf("Usage: %s filename ", argv[0]);
exit (1);
}
if ( stat( argv[1], &stat_buf) == ERR)
{
perror("stat");
exit (1);
}
printf(" File: %s status: ",argv[1]);
if ((stat_buf.st_mode & S_IFMT) == S_IFDIR)
printf("Directory ");
else if ((stat_buf.st_mode & S_IFMT) == S_IFBLK)
{
printf("Block special file ");
isdevice = TRUE;
}
else if ((stat_buf.st_mode & S_IFMT) == S_IFCHR)
{
printf("Character special file ");
isdevice = TRUE;
}
else if ((stat_buf.st_mode & S_IFMT) == S_IFREG)
printf("Ordinary file ");
else if ((stat_buf.st_mode & S_IFMT) == S_IFIFO)
printf("FIFO ")

if (isdevice)
printf("Device number:%d, %d ", (stat_buf.st_rdev > 8) & 0377,   
stat_buf.st_rdev & 0377);
printf("Resides on device:%d, %d ", (stat_buf.st_dev > 8) & 0377,   
stat_buf.st_dev & 0377);
printf("I-node: %d; Links: %d; Size: %ld ", stat_buf.st_ino,   
stat_buf.st_nlink, stat_buf.st_size);
if ((stat_buf.st_mode & S_ISUID) == S_ISUID)
printf("Set-user-ID ");
if ((stat_buf.st_mode & S_ISGID) == S_ISGID)
printf("Set-group-ID ");
if ((stat_buf.st_mode & S_ISVTX) == S_ISVTX)
printf("Sticky-bit set -- save swapped text after use ");
printf("Permissions: %o ", stat_buf.st_mode & 0777);

exit (0);
}