Sponsored Content
Top Forums UNIX for Beginners Questions & Answers ksh script to validate the record count status Post 303045398 by senmng on Thursday 19th of March 2020 12:23:26 PM
Old 03-19-2020
ksh script to validate the record count status

Hi - I have a KSH script to execute a oracle job to generate a data file and then ftp the same file to the downstream application. Here currently we have a validation check that not to send the file to downstream even if there is any partial record rejection with the data file. But i now want to transmit the file to the downstream if it's have single data of record irrespective of n number of rejection of records.Here is the snippet of code-

Code:
     LOG ="/dir/local/xyz`.log"

        TRNSERR=0
        CNT=1

        while [ $CNT -lt 4 ]
        do
                  ftp -nv < /local/cimspapp/CIMSbatch/script/FTP/CLAIMDNLD.ftp >> $sh_Trans

               cat $sh_Trans |grep -v bytes| awk '{print $1}' | egrep -e '530|425 > /dev/null
                # If error number found
                if [ $? -eq 0 ]
                then
                         echo "Error in Transmission" >> $sh_Trans
                         CNT=`expr $CNT + 1`
                        TRNSERR=1
                        
                else
                       grep -i "Not connected" $sh_Trans
                        if [ $? -eq 0 ]
                        then
                                echo "Connection Error" >> $sh_Trans
                                CNT=`expr $CNT + 1`
                                TRNSERR=1
                                sleep 100
                        else
                                TRNSERR=0
                                CNT=4
                        fi
                fi
        done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replaying a record count with another record count

i use unix command to take the record count for a file1 awk 'END{print NR}' filename i already have a file2 which conatin the count like ... .. rec_cnt=100 .. .. I want to replace the record in the file2 using the record i take from file1. suggest me some simple ways of doing it... (2 Replies)
Discussion started by: er_zeeshan05
2 Replies

2. Shell Programming and Scripting

HELP WITH .ksh script converting the exit status

Hi Can someone help me please? In a standard UNIX .ksh script, if you have the exit status..say 5...what line do you have to enter into the script for this number to be automatically converted to its actual exit reason by looking up the exit status file...wherever that is? thanks angus (1 Reply)
Discussion started by: angusyoung
1 Replies

3. Shell Programming and Scripting

Validate record count

Hi all How to verify the number of records in case of delimited file, If the file has records. And then if it is not equal to mentioned no. of records, email is triggered and file is moved to bad directory path. Example ----- input file = a.txt bad directory path : /usr/bin/bad (6 Replies)
Discussion started by: balaji23_d
6 Replies

4. Shell Programming and Scripting

Help in writing a KSH script to filter the latest record?

Hi All, I have a text file with the folowing content. BANGALORE|1417|2010-02-04 08:41:04.174|dob|xxx BANGALORE|1416|2010-02-04 08:23:19.566|dob|yyy BANGALORE|1415|2010-02-04 08:20:14.497|dob|aaa BANGALORE|1414|2010-02-04 08:19:40.065|dob|vvv BANGALORE|1413|2010-02-04... (4 Replies)
Discussion started by: Karpak
4 Replies

5. Shell Programming and Scripting

exit status from ksh script exec from java using runtime

how do i get the exit status from a ksh or perl script executed in a java program using Runtime? (1 Reply)
Discussion started by: twk
1 Replies

6. Shell Programming and Scripting

Exit status of the ksh Script

Hi Im trying to write a script that will archive some file using java program.Below is the part of the script that I use and my problem is that the script always return with status 0.Below is part of my script(end part) purge.ksh echo "No of files before tar :... (4 Replies)
Discussion started by: saachinsiva
4 Replies

7. Shell Programming and Scripting

Print record count of a file using shell script

HI, I need to print the record count of a file using shell script. If the record count of a file excluding header and trailer record if greater than zero then print 'Record count of a file is xxxx records'. If the record count is zero print 'zero records' Thanks Mahendra (1 Reply)
Discussion started by: mmeda
1 Replies

8. Shell Programming and Scripting

Validate file count in korn shell script

Hi, I have files in the directory like below which I need to validate if all the required files are present. A_B_001 of 002_time1.txt A_B_002 of 002_time1.txt A_B_001 of 001_time2.txt Scenarios- a)If file with 001 of 002_time1 or 002 of 002_time1 is missing in the folder,script should... (6 Replies)
Discussion started by: aneeta13
6 Replies

9. Shell Programming and Scripting

Any Sample ksh script to validate all the database objects

Hi, I need a sample script to validate all the database objects like 1. table structure(columns, datatypes,key contraints if any) 2. synonyms 3. grants 4. indexes ....etc thank you! (2 Replies)
Discussion started by: srikanth_sagi
2 Replies

10. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies
PSTAT(1M)																 PSTAT(1M)

NAME
pstat - print system facts SYNOPSIS
pstat [ -aixptuf ] [ suboptions ] [ file ] DESCRIPTION
Pstat interprets the contents of certain system tables. If file is given, the tables are sought there, otherwise in /dev/mem. The required namelist is taken from /unix. Options are -a Under -p, describe all process slots rather than just active ones. -i Print the inode table with the these headings: LOC The core location of this table entry. FLAGS Miscellaneous state variables encoded thus: L locked U update time filsys(5)) must be corrected A access time must be corrected M file system is mounted here W wanted by another process (L flag is on) T contains a text file C changed time must be corrected CNT Number of open file table entries for this inode. DEV Major and minor device number of file system in which this inode resides. INO I-number within the device. MODE Mode bits, see chmod(2). NLK Number of links to this inode. UID User ID of owner. SIZ/DEV Number of bytes in an ordinary file, or major and minor device of special file. -x Print the text table with these headings: LOC The core location of this table entry. FLAGS Miscellaneous state variables encoded thus: T ptrace(2) in effect W text not yet written on swap device L loading in progress K locked w wanted (L flag is on) DADDR Disk address in swap, measured in multiples of 512 bytes. CADDR Core address, measured in multiples of 64 bytes. SIZE Size of text segment, measured in multiples of 64 bytes. IPTR Core location of corresponding inode. CNT Number of processes using this text segment. CCNT Number of processes in core using this text segment. -p Print process table for active processes with these headings: LOC The core location of this table entry. S Run state encoded thus: 0 no process 1 waiting for some event 3 runnable 4 being created 5 being terminated 6 stopped under trace F Miscellaneous state variables, or-ed together: 01 loaded 02 the scheduler process 04 locked 010 swapped out 020 traced 040 used in tracing 0100 locked in by lock(2). PRI Scheduling priority, see nice(2). SIGNAL Signals received (signals 1-16 coded in bits 0-15), UID Real user ID. TIM Time resident in seconds; times over 127 coded as 127. CPU Weighted integral of CPU time, for scheduler. NI Nice level, see nice(2). PGRP Process number of root of process group (the opener of the controlling terminal). PID The process ID number. PPID The process ID of parent process. ADDR If in core, the physical address of the `u-area' of the process measured in multiples of 64 bytes. If swapped out, the position in the swap area measured in multiples of 512 bytes. SIZE Size of process image in multiples of 64 bytes. WCHAN Wait channel number of a waiting process. LINK Link pointer in list of runnable processes. TEXTP If text is pure, pointer to location of text table entry. CLKT Countdown for alarm(2) measured in seconds. -t Print table for terminals (only DH11 and DL11 handled) with these headings: RAW Number of characters in raw input queue. CAN Number of characters in canonicalized input queue. OUT Number of characters in putput queue. MODE See tty(4). ADDR Physical device address. DEL Number of delimiters (newlines) in canonicalized input queue. COL Calculated column position of terminal. STATE Miscellaneous state variables encoded thus: W waiting for open to complete O open S has special (output) start routine C carrier is on B busy doing output A process is awaiting output X open for exclusive use H hangup on close PGRP Process group for which this is controlling terminal. -u print information about a user process; the next argument is its address as given by ps(1). The process must be in main memory, or the file used can be a core image and the address 0. -f Print the open file table with these headings: LOC The core location of this table entry. FLG Miscellaneous state variables encoded thus: R open for reading W open for writing P pipe CNT Number of processes that know this open file. INO The location of the inode table entry for this file. OFFS The file offset, see lseek(2). FILES
/unix namelist /dev/mem default source of tables SEE ALSO
ps(1), stat(2), filsys(5) K. Thompson, UNIX Implementation PSTAT(1M)
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy