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
/

This will get you the number of lines in the files

file1count=`cat <file1> | wc -l`
file2count=`cat <file2> | wc -l`

echo "File 1 has $file1count rows\n"
echo "File 2 has $file2count rows\n"

its not workng in perl

not sure wat syntax to use in perl for this

The example I posted is not perl, its can be run is shell.