The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
I want records in file2 those are not exist in file1 suresh3566 Shell Programming and Scripting 3 10-27-2008 05:59 AM
Filtering records of a file based on a value of a column risk_sly UNIX for Dummies Questions & Answers 4 09-24-2008 03:22 AM
Check valid records in really big file with one commend.. vtischuk@yahoo. Shell Programming and Scripting 3 05-18-2008 04:54 PM
Count No of Records in File without counting Header and Trailer Records guiguy Shell Programming and Scripting 2 06-07-2007 01:15 PM
Select records based on search criteria on first column shashi_kiran_v UNIX for Dummies Questions & Answers 2 12-02-2005 01:49 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-21-2008
mavesum mavesum is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 12
Based on num of records in file1 need to check records in file2 to set some condns

Hi All,

I have two files say file1 and file2.

I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .

Could you pls help me what would be the perl script look like , i dont knw the syntax

As 'm new in this business any help is appreciated .

it wud be sumthng like

IF (file1 has atleast 2 records )
IF(file2 has atleast 1 record)
set condition1
END
ELSE-
set condition2

Currently we are using IDCAMS in mainframes to do this ...but it needs to be converted to perl scripts.If you want more elaboration , the IDCAMS code is

//STEP02 EXEC PGM=IDCAMS,COND=(0,NE)
//SYSPRINT DD SYSOUT=(,),OUTPUT=(*.JESP)
//ARCHIVO DD DSN=PRODAS.AS07.ARCHIVE(+0),DISP=(OLD,PASS)
//ARCHIVN DD DSN=PRODAS.AS07.ARCHIVE(+1),DISP=(OLD,PASS)
//SYSIN DD *
PRINT INFILE(ARCHIVO) COUNT(2)
IF LASTCC = 0 THEN -
DO
PRINT INFILE(ARCHIVN) COUNT(1) IF atleast one
IF LASTCC=4 THEN -
SET MAXCC=1
END
ELSE -
IF LASTCC=4 THEN -
SET MAXCC=0
/*
 

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0