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
Business::EDI::Spec(3pm)				User Contributed Perl Documentation				  Business::EDI::Spec(3pm)

NAME
Business::EDI::Spec - Object class for CSV-based U.N. EDI specifications SYNOPSIS
use Business::EDI::Spec; my $spec = Business::EDI::Spec->new('segment'); DESCRIPTION
CSV files originally from edi4r are included as part of Business::EDI. They are used to define the many different messages, segements, data elements, composite data elements, and codelists that are part of a given version of the U.N. specification. The CSV spec files are composed differently for the different structures defined. So we have to parse them differently. ==> Business/EDI/data/edifact/untdid/EDCD.d07a.csv # Composite Elements CompositeCode;label;pos;code;mandatory;def;[pos;code;mandatory;def;...] C001;TRANSPORT MEANS;010;8179;C;an..8;020;1131;C;an..17;030;3055;C;an..3;040;8178;C;an..17; C002;DOCUMENT/MESSAGE NAME;010;1001;C;an..3;020;1131;C;an..17;030;3055;C;an..3;040;1000;C;an..35; C004;EVENT CATEGORY;010;9637;C;an..3;020;1131;C;an..17;030;3055;C;an..3;040;9636;C;an..70; C001 => {label => 'TRANSPORT MEANS;010;8179;C;an..8;020;1131;C;an..17;030;3055;C;an..3;040;8178;C;an..17; ==> Business/EDI/data/edifact/untdid/EDED.d07a.csv # Data Elements code;def;class(?):label 1000;an..35;B;Document name 1001;an..3;C;Document name code 1003;an..6;B;Message type code 1000 => {label => 'an..35;B;Document name ==> Business/EDI/data/edifact/untdid/EDMD.d07a.csv # Messages MessageCode:x:rel:org:z:SegmentGroup;label;SegCode;mandatory;repeats;[SegCode;mandatory;repeats;...] APERAK:D:07A:UN::;Application error and acknowledgement message;UNH;M;1;BGM;M;1;DTM;C;9;FTX;C;9;CNT;C;9;SG1;C;99;SG2;C;9;SG3;C;9;SG4;C;99999;UNT;M;1 APERAK:D:07A:UN::SG1;SG01;DOC;M;1;DTM;C;99 APERAK:D:07A:UN::SG2;SG02;RFF;M;1;DTM;C;9 APERAK:D:07A:UN:: => {label => 'Application error and acknowledgement message', UNH;M;1; BGM;M;1; DTM;C;9;FTX;C;9;CNT;C;9;SG1;C;99;SG2;C;9;SG3;C;9;SG4;C;99999;UNT;M;1 ==> Business/EDI/data/edifact/untdid/EDSD.d07a.csv # Segments SegCode;label;pos;code;class;repeats[pos;code;class;repeats;...] ADR;ADDRESS;010;C817;C;1;020;C090;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;C819;C;5;070;C517;C;5; AGR;AGREEMENT IDENTIFICATION;010;C543;C;1;020;9419;C;1; AJT;ADJUSTMENT DETAILS;010;4465;M;1;020;1082;C;1; ADR => {label => 'ADDRESS', 010;C817;C;1;020;C090;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;C819;C;5;070;C517;C;5; ==> Business/EDI/data/edifact/untdid/IDCD.d07a.csv # Composites (interactive) E001 => {label => 'ADDRESS DETAILS;010;3477;M;an..3;020;3286;M;an..70;030;3286;C;an..70;040;3286;C;an..70;050;3286;C;an..70;060;3286;C;an..70;070;3286;C;an..70; ==> Business/EDI/data/edifact/untdid/IDMD.d07a.csv # Messages (interactive) MsgCode:x:rel:org:z:SegmentGroup;label;SegCode;mandatory;class;repeats;;[mandatory;class;repeats;...] IHCEBI:D:07A:UN::;Interactive health insurance eligibility and benefits inquiry and;UIH;M;1;MSD;M;1;SG1;C;9;SG2;C;1;UIT;M;1 IHCEBI:D:07A:UN::SG1;SG01;PRT;M;1;NAA;C;9;CON;C;9;FRM;C;9 IHCEBI:D:07A:UN::SG2;SG02;DTI;M;1;ICI;C;1;FRM;C;9;SG3;C;999 IHCEBI:D:07A:UN::SG3;SG03;BCD;M;1;HDS;C;9;DTI;C;1;PRT;C;9;FRM;C;9 IHCLME:D:07A:UN::;Health care claim or encounter request and response - interactive;UIH;M;1;MSD;C;1;PRT;C;9;NAA;C;9;CON;C;9;BLI;C;1;ITC;C;1;FRM;C;99;SG1;C;3;SG2;C;99;UIT;M;1 IHCLME:D:07A:UN::SG1;SG01;OTI;M;1;NAA;C;2 IHCLME:D:07A:UN::SG2;SG02;PSI;M;1;DNT;C;35 ==> Business/EDI/data/edifact/untdid/IDSD.d07a.csv # Segments (interactive) SegCode;label;pos;code;mandatory;repeats(?) AAI;ACCOMMODATION ALLOCATION INFORMATION;010;E997;M;20; ADS;ADDRESS;010;E817;C;1;020;E001;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;E819;C;1;070;E517;C;1; AAI => {label => 'ACCOMMODATION ALLOCATION INFORMATION', pos => '010', E997;M;20; TO DO
Parsing for interactive specs. SEE ALSO
edi4r - http://edi4r.rubyforge.org Business::EDI AUTHOR
Joe Atzberger perl v5.12.4 2010-09-08 Business::EDI::Spec(3pm)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy