Return to site

How To Get System Date In Cl Program

broken image


The default history command output is always sorted by date unless there are any changes made to the configuration. The output is not in date order because session writes their history at different times. History file is written when the session gets over. Follow the steps given below to the date of execution in the history command output.

The default output of history command is as shown below without the date and time details:

Getting date and time of executed command in the history command output

Other date stuff from cl wrksysval.DATTIM All my answers were extracted from the 'Big Dummy's Guide to the As400' and I take no responsibility for any of them. Code400 Newbie. Join Date: May 2005; Posts: 39; Share Tweet #3. February 9th, 2006, 09:41 AM. Re: how to validate a date in CL? - Hi, Michael: Try using the CVTDAT command. You could do something like this: DCL VAR(&DATE) TYPE(.CHAR) LEN(10) /. date in YYYY-MM-DD format./ DCL VAR(&RSLT) TYPE(.CHAR) LEN(10) /. result: validated date YYYY-MM-DD./ DCL VAR(&VLDD) TYPE(.LGL) /. valid d. FFh invalid date, system date unchanged; Note: DOS 3.3+ also sets CMOS clock. SeeAlso: AH=2Ah,AH=2Dh. AH = 2Ch - GET SYSTEM TIME. Return: CH = hour CL = minute DH = second DL = 1/100 seconds. Note: on most systems, the resolution of the system clock is about 5/100sec, so returned times generally do not increment by 1 on some systems, DL may. The fastopen command is used to add a program's hard drive location to a special list stored in memory, potentially improving the program's launch time by removing the need for MS-DOS to locate the application on the drive. Fc: The fc command is used to compare two individual or sets of files and then show the differences between them.

1. Edit file /etc/bashrc and add the below entry. Make sure to have the space after %T.

2. Login in to the system.

3. Check if variable has been exported.

4. Type history command and check if time is getting displayed.

5. To have output sorted according to date run on use the sort command along with the history command.

Solaris : How to include date and timestamp in bash shell command history
CentOS / RHEL : How to disable BASH shell history
UNIX / Linux : Examples of bash history command to repeat last commands

DOS INT 21h - DOS Function Codes

The follow abridged list of DOS interrupts has been extracted from alarge list compiled by Ralf Brown. These are available on any Simtel mirror(e.g. sunsite.anu.edu.au)under the directory ms-dos/info/interNNp.zip

AHDescriptionAHDescription
01Readcharacter from STDIN02Writecharacter to STDOUT
05Writecharacter to printer06ConsoleInput/Output
07Directchar read (STDIN), no echo08Charread from STDIN, no echo
09Writestring to STDOUT0ABufferedinput
0BGet STDINstatus0CFlushbuffer for STDIN
0DDiskreset0ESelectdefault drive
19Getcurrent default drive25Set interruptvector
2AGet systemdate2BSet systemdate
2CGet systemtime2DSet systemtime
2ESet verifyflag30Get DOSversion
35Get Interruptvector
36Get freedisk space39Createsubdirectory
3ARemovesubdirectory3BSet workingdirectory
3CCreatefile3DOpenfile
3EClosefile3FReadfile
40Writefile41Deletefile
42Seekfile43Get/Setfile attributes
47Get currentdirectory4CExitprogram
4DGet returncode54Get verifyflag
56Renamefile57Get/Setfile date

AH= 01h - READ CHARACTER FROM STANDARD INPUT, WITH ECHO

Return: AL = character read

Notes:

  • ^C/^Break are checked
  • ^P toggles the DOS-internal echo-to-printer flag
  • ^Z is not interpreted, thus not causing an EOF if input is redirectedcharacter is echoed to standard output

SeeAlso: AH=06h,AH=07h,AH=08h,AH=0Ah

AH= 02h -WRITE CHARACTER TO STANDARD OUTPUT

Entry: DL = character to write

Return: AL = last character output

Notes:

  • ^C/^Break are checked
  • the last character output will be the character in DL unless DL=09hon entry, in which case AL=20h as tabs are expanded to blanks
  • if standard output is redirected to a file, no error checks (write-protected, full media, etc.) are performed

SeeAlso: AH=06h,AH=09h

AH= 05h - WRITE CHARACTER TO PRINTER

Entry: DL = character to print

Notes:

  • keyboard checked for ^C/^Break
  • STDPRN is usually the first parallel port, but may be redirected underDOS 2+
  • if the printer is busy, this function will wait

SeeAlso: INT 17/AH=00h

AH= 06h - DIRECT CONSOLE OUTPUT

Entry: DL = character (except FFh)

Return: AL = character output

Notes: does not check ^C/^Break

SeeAlso: AH=02h,AH=09h

AH= 06h - DIRECT CONSOLE INPUT

Entry: AH = 06h DL = FFh

Return:

  • ZF set if no character available and AL = 00h
  • ZF clear if character available AL = character read
How To Get System Date In Cl Program

Notes:

  • ^C/^Break are NOT checked
  • if the returned character is 00h, the user pressed a key with an extendedkeycode, which will be returned by the next call of this function
  • although the return of AL=00h when no characters are available is notdocumented, some programs rely on this behavior

SeeAlso: AH=0Bh

AH=07h- DIRECT CHARACTER INPUT, WITHOUT ECHO

Return: AL = character read from standard input

Notes: does not check ^C/^Break

SeeAlso: AH=01h,AH=06h,AH=08h,AH=0Ah

AH= 08h - CHARACTER INPUT WITHOUT ECHO

Return: AL = character read from standard input

Notes: ^C/^Break are checked

SeeAlso: AH=01h,AH=06h,AH=07h,AH=0Ah,AH=64h

AH= 09h - WRITE STRING TO STANDARD OUTPUT

Entry: DS:DX -> '$'-terminated string

Return: AL = 24h

Notes: ^C/^Break are checked

SeeAlso: AH=02h,AH=06h'OUTPUT'

AH= 0Ah - BUFFERED INPUT

Entry: DS:DX -> buffer(see below)

Return: buffer filled with user input

Notes:

  • ^C/^Break are checked
  • reads from standard input

SeeAlso: AH=0Ch

Format of DOS input buffer:

OffsetSizeDescription
001maximum characters buffer can hold
011number of chars from last input which may be recalled OR number ofcharacters actually read, excluding CR
02nactual characters read, including the final carriage return

AH=0Bh- GET STDIN STATUS

Return:

  • AL = 00h if no character available
  • AL = FFh if character is available

Notes: ^C/^Break are checked

SeeAlso: AH=06h'INPUT'

AH= 0Ch - FLUSH BUFFER AND READ STANDARD INPUT

Entry:

  • AL = STDIN input function to execute after flushing buffer
  • other registers as appropriate for the input function

Return: as appropriate for the specified input function

Note: if AL is not one of 01h,06h,07h,08h, or 0Ah, the buffer is flushedbut no input is attempted

SeeAlso: AH=01h,AH=06h'INPUT',AH=07h,AH=08h,AH=0Ah

AH= 0Dh - DISK RESET

Notes: This function writes all modified disk buffers to disk, but doesnot update the directory information

SeeAlso: AX=5D01h

AH= 0Eh - SELECT DEFAULT DRIVE

Entry: DL = new default drive (0=A:, 1=B:, etc)

Return: AL = number of potentially valid drive letters

Notes: the return value is the highest drive present

SeeAlso: AH=19h,AH=3Bh,AH=DBh

AH= 19h - GET CURRENT DEFAULT DRIVE

Return: AL = drive (0=A:, 1=B:, etc)

SeeAlso: AH=0Eh,AH=47h,AH=BBh

AH= 25h - SET INTERRUPT VECTOR

Entry:

  • AL = interrupt number
  • DS:DX -> new interrupt handler

Notes: this function is preferred over direct modification of the interruptvector table

SeeAlso: AX=2501h,AH=35h

AH= 2Ah - GET SYSTEM DATE

Return: CX = year (1980-2099) DH = month DL = day AL = day of week (00h=Sunday)

SeeAlso: AH=2Bh'DOS',AH=2Ch,AH=E7h

AH= 2Bh - SET SYSTEM DATE

Entry: CX = year (1980-2099) DH = month DL = day

Return:

  • AL = 00 successful
  • FFh invalid date, system date unchanged

Note: DOS 3.3+ also sets CMOS clock

SeeAlso: AH=2Ah,AH=2Dh

AH= 2Ch - GET SYSTEM TIME

Return: CH = hour CL = minute DH = second DL = 1/100 seconds

Note: on most systems, the resolution of the system clock is about 5/100sec,so returned times generally do not increment by 1 on some systems, DL mayalways return 00h

SeeAlso: AH=2Ah,AH=2Dh,AH=E7h

AH= 2Dh - SET SYSTEM TIME

Entry: CH = hour CL = minute DH = second DL = 1/100 seconds

Return:

  • AL = 00h successful
  • FFh if invalid time, system time unchanged

Note: DOS 3.3+ also sets CMOS clock

SeeAlso: AH=2Bh'DOS',AH=2Ch

AH= 2Eh - SET VERIFY FLAG

Entry: AL = new state of verify flag (00 off, 01h o)

Notes:

  • default state at system boot is OFF
  • when ON, all disk writes are verified provided the device driver supportsread-after-write verification

SeeAlso: AH=54h

AH=30h- GET DOS VERSION

Entry: AL = what to return in BH (00h OEM number, 01h version flag)

Return:

  • AL = major version number (00h if DOS 1.x)
  • AH = minor version number
  • BL:CX = 24-bit user serial number (most versions do not use this) ifDOS <5 or AL=00h
  • BH = MS-DOS OEM number if DOS 5+ and AL=01h
  • BH = version flag bit 3: DOS is in ROM other: reserved (0)

Notes:

  • DOS 4.01 and 4.02 identify themselves as version 4.00
  • MS-DOS 6.21 reports its version as 6.20; version 6.22 returns the correctvalue
  • Windows95 returns version 7.00 (the underlying MS-DOS)

SeeAlso: AX=3000h/BX=3000h,AX=3306h,AX=4452h

AH=35h- GET INTERRUPT VECTOR

Entry: AL = interrupt number

Return: ES:BX -> current interrupt handler

SeeAlso: AH=25h,AX=2503h

AH= 36h - GET FREE DISK SPACE

Entry: DL = drive number (0=default, 1=A:, etc)

Return:

  • AX = FFFFh if invalid drive
  • AX = sectors per cluster BX = number of free clusters CX = bytes persector DX = total clusters on drive

Notes:

  • free space on drive in bytes is AX * BX * CX
  • total space on drive in bytes is AX * CX * DX
  • 'lost clusters' are considered to be in use
  • this function does not return proper results on CD-ROMs; use AX=4402h'CD-ROM'instead

SeeAlso: AH=1Bh,AH=1Ch,AX=4402h'CD-ROM'

AH= 39h - 'MKDIR' - CREATE SUBDIRECTORY

Entry: DS:DX -> ASCIZ pathname

Return:

  • CF clear if successful AX destroyed
  • CF set on error AX = error code (03h,05h)

Notes:

  • all directories in the given path except the last must exist
  • fails if the parent directory is the root and is full
  • DOS 2.x-3.3 allow the creation of a directory sufficiently deep thatit is not possible to make that directory the current directory becausethe path would exceed 64 characters

SeeAlso: AH=3Ah,AH=3Bh,AH=6Dh

AH= 3Ah - 'RMDIR' - REMOVE SUBDIRECTORY Realtek transcode server software.

Entry: DS:DX -> ASCIZ pathname of directory to be removed

Return:

  • CF clear if successful, AX destroyed
  • CF set on error AX = error code (03h,05h,06h,10h)

Notes: directory must be empty (contain only '.' and '.' entries)

SeeAlso: AH=39h,AH=3Bh

AH= 3Bh - 'CHDIR' - SET CURRENT DIRECTORY

Entry: DS:DX -> ASCIZ pathname to become current directory (max 64bytes)

Return:

  • CF clear if successful, AX destroyed
  • CF set on error AX = error code (03h)

Notes: if new directory name includes a drive letter, the default driveis not changed, only the current directory on that drive

SeeAlso: AH=47h,AH=71h,INT 2F/AX=1105h

AH= 3Ch - 'CREAT' - CREATE OR TRUNCATE FILE

Entry:

  • CX = fileattributes
  • DS:DX -> ASCIZ filename

Return:

  • CF clear if successful, AX = file handle
  • CF set on error AX = error code (03h,04h,05h)

Notes: if a file with the given name exists, it is truncated to zerolength

SeeAlso: AH=16h,AH=3Dh,AH=5Ah,AH=5Bh

Duplicate manager pro 1.2.8 full %2b crack mac os x. AH= 3Dh - 'OPEN' - OPEN EXISTING FILE

Entry:

  • AL = access and sharing modes
  • DS:DX -> ASCIZ filename

Return:

  • CF clear if successful, AX = file handle
  • CF set on error AX = error code (01h,02h,03h,04h,05h,0Ch,56h)

Notes:

  • file pointer is set to start of file
  • file handles which are inherited from a parent also inherit sharingand access restrictions
  • files may be opened even if given the hidden or system attributes

SeeAlso: AH=0Fh,AH=3Ch,AX=4301h,AX=5D00h

AH= 3Eh - 'CLOSE' - CLOSE FILE

Entry: BX = file handle

Return:

  • CF clear if successful, AX destroyed
  • CF set on error, AX = error code (06h)

Note: if the file was written to, any pending disk writes are performed,the time and date stamps are set to the current time, and the directoryentry is updated

SeeAlso: AH=10h,AH=3Ch,AH=3Dh

AH= 3Fh - 'READ' - READ FROM FILE OR DEVICE

Entry:

  • BX = file handle
  • CX = number of bytes to read
  • DS:DX -> buffer for data

Return:

  • CF clear if successful - AX = number of bytes actually read (0 if atEOF before call)
  • CF set on error AX = error code (05h,06h)

Notes:

  • data is read beginning at current file position, and the file positionis updated after a successful read
  • the returned AX may be smaller than the request in CX if a partialread occurred
  • if reading from CON, read stops at first CR

SeeAlso: AH=27h,AH=40h,AH=93h

AH=40h- 'WRITE' - WRITE TO FILE OR DEVICE

Entry:

  • BX = file handle
  • CX = number of bytes to write
  • DS:DX -> data to write

Return:

  • CF clear if successful -AX = number of bytes actually written
  • CF set on error - AX = error code (05h,06h)

Notes:

  • if CX is zero, no data is written, and the file is truncated or extendedto the current position
  • data is written beginning at the current file position, and the fileposition is updated after a successful write
  • the usual cause for AX < CX on return is a full disk

SeeAlso: AH=28h,AH=3Fh

AH= 41H - 'UNLINK' - DELETE FILE

Entry:

  • DS:DX -> ASCIZ filename (no wildcards, but see notes)
  • CL = attribute mask for deletion (server call only, see notes)

Return:

  • CF clear if successful, AX destroyed (DOS 3.3) AL seems to be driveof deleted file
  • CF set on error AX = error code (02h,03h,05h)

Notes:

  • (DOS 3.1+) wildcards are allowed if invoked via AX=5D00h, in whichcase the filespec must be canonical (as returned by AH=60h), and only filesmatching the attribute mask in CL are deleted
  • DOS does not erase the file's data; it merely becomes inaccessiblebecause the FAT chain for the file is cleared
  • deleting a file which is currently open may lead to filesystem corruption.

SeeAlso: AH=13h,AX=4301h,AX=4380h,AX=5D00h,AH=60h,AH=71h

AH=42h- 'LSEEK' - SET CURRENT FILE POSITION

Entry:

  • AL = origin of move 00h start of file 01h current file position 02hend of file
  • BX = file handle
  • CX:DX = offset from origin of new file position

How To Get System Date In Cl Programs

Return:

  • CF clear if successful, DX:AX = new file position in bytes from startof file
  • CF set on error, AX = error code (01h,06h)

Notes:

  • for origins 01h and 02h, the pointer may be positioned before the startof the file; no error is returned in that case, but subsequent attemptsat I/O will produce errors
  • if the new position is beyond the current end of file, the file willbe extended by the next write (see AH=40h)

SeeAlso: AH=24h

AH=43- GET FILE ATTRIBUTES

Entry:

  • AL = 00h
  • DS:DX -> ASCIZ filename

Return:

  • CF clear if successful CX = fileattributes
  • CF set on error, AX = error code (01h,02h,03h,05h)

BUG: Windows for Workgroups returns error code 05h (access denied) insteadof error code 02h (file not found) when attempting to get the attributesof a nonexistent file.

SeeAlso: AX=4301h,AX=4310h,AX=7143h,AH=B6h

AH=43- 'CHMOD' - SET FILE ATTRIBUTES

Entry:

  • AL = 01h
  • CX = new fileattributes
  • DS:DX -> ASCIZ filename

How To Get System Date In Cl Program Tutorial

Return:

  • CF clear if successful, AX destroyed
  • CF set on error, AX = error code (01h,02h,03h,05h)

Notes:

  • will not change volume label or directory attribute bits, but willchange the other attribute bits of a directory
  • MS-DOS 4.01 reportedly closes the file if it is currently open

SeeAlso: AX=4300h,AX=4311h,AX=7143h,INT 2F/AX=110Eh

Bitfields for file attributes:

Bits76543210
Descriptionshareable-archivedirectoryvol. labelsystemhiddenread-only

AH= 47h - 'CWD' - GET CURRENT DIRECTORY

Entry:

  • DL = drive number (00h = default, 01h = A:, etc)
  • DS:SI -> 64-byte buffer for ASCIZ pathname

Return:

  • CF clear if successful
  • CF set on error, AX = error code (0Fh)

Notes:

  • the returned path does not include a drive or the initial backslash
  • many Microsoft products for Windows rely on AX being 0100h on success

SeeAlso: AH=19h,AH=3Bh,AH=71h

AH= 4Ch - 'EXIT' - TERMINATE WITH RETURN CODE

Entry: AL = return code

Return: never returns

Notes: unless the process is its own parent, all open files are closedand all memory belonging to the process is freed

SeeAlso: AH=00h,AH=26h,AH=4Bh,AH=4Dh

AH= 4Dh - GET RETURN CODE (ERRORLEVEL)

Return:

  • AH = termination type (00=normal, 01h control-C abort, 02h=criticalerror abort, 03h terminate and stay resident)
  • AL = return code

Notes:

  • the word in which DOS stores the return code is cleared after beingread by this function, so the return code can only be retrieved once
  • COMMAND.COM stores the return code of the last external command itexecuted as ERRORLEVEL

SeeAlso: AH=4Bh,AH=4Ch,AH=8Ah

AH= 54h - GET VERIFY FLAG

Return: AL = verify flag (00h=off, 01h=on, i.e. all disk writes verifiedafter writing)

SeeAlso: AH=2Eh

AH= 56h - 'RENAME' - RENAME FILE

Entry:

  • DS:DX -> ASCIZ filename of existing file (no wildcards, but seebelow)
  • ES:DI -> ASCIZ new filename (no wildcards)
  • CL = attribute mask (server call only, see below)

Return:

  • CF clear if successful
  • CF set on error, AX= error code (02h,03h,05h,11h)

Notes:

  • allows move between directories on same logical volume
  • this function does not set the archive attribute
  • open files should not be renamed
  • (DOS 3.0+) allows renaming of directories

AH= 57h - GET FILE'S LAST-WRITTEN DATE AND TIME

Entry:

  • AL = 00h (Get attribute)
  • BX = file handle

Return:

  • CF clear if successful, CX = file's time DX = file's date
  • CF set on error, AX = error code (01h,06h)

SeeAlso: AX=5701h

Bitfields for file time:

Bits15-1110-54-0
Descriptionhoursminutesseconds

Bitfields for file date:

Bits15-98-54-0
Descriptionyear (1980-)monthday

AH= 57h - SET FILE'S LAST-WRITTEN DATE AND TIME

Entry:

  • AL =01h (Set attributes)
  • BX = file handle
  • CX = new time
  • DX = newdate

Return:

  • CF clear if successful
  • CF set on error AX = error code (01h,06h)

SeeAlso: AX=5700h

This page is maintained by BarryWilks.





broken image