MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PL1 compares

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
madhan1582
Beginner


Joined: 16 May 2007
Posts: 5
Topics: 4
Location: Newyork

PostPosted: Mon Sep 24, 2007 7:06 pm    Post subject: PL1 compares Reply with quote

1.I am new to Pl1 . Can somebody help me in comparing two PS files in PL1. The requirement is

I have 2 PS files of lrecl 80.But my file contains data as described below.

Note: there is a space between each variable.
I need to compare the variable1( alphabets) of file1 to match it with file2
& if match is found the file2 attributes needs to written in output, if not file1 must be written in the output.

File1
-----
RSTVU 555 777
ABC 111 222
WXYZ 333 444

File2
-----
ABC 222 999
TUVQ 789 654
WXYZ 111 555

Output file
-----------
ABC 222 999
RSTVU 555 777
WXYZ 333 444


2. I have used TRIM function in my another Pl1 pgm , but while compiling it gives me an error like " trim function not defined" , But I have defined it as a built-in variable. Is it some compiler problem?
_________________
I would like to share some of my known and doubtful things.
Back to top
View user's profile Send private message Yahoo Messenger
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Tue Sep 25, 2007 3:02 am    Post subject: Reply with quote

madhan1582,


(1) How large are files, number of records ? The files seem not to be sorted according the variables, right ? So for small files read the content into an array anf check using to nested loops, for larger files open the smaller file, read each record, open the larger file search for same variable, compare the content.

(2) TRIM function: Which version of PL1 are you using ? DCL TRIM BUILTIN should work. Pls provide the error number.


regards,
bauer
Back to top
View user's profile Send private message
madhan1582
Beginner


Joined: 16 May 2007
Posts: 5
Topics: 4
Location: Newyork

PostPosted: Tue Sep 25, 2007 11:19 pm    Post subject: Reply with quote

1.the files can be sorted.. & contains recors of 4500 aprox. ( each file)

2.Iam sure which version .. how to check that?
_________________
I would like to share some of my known and doubtful things.
Back to top
View user's profile Send private message Yahoo Messenger
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Wed Sep 26, 2007 2:10 am    Post subject: Reply with quote

madhan1582,

(1) is your problem the PL1 Syntax or the algorithem?
(2) see headerline of compilelisting
Back to top
View user's profile Send private message
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Thu Sep 27, 2007 5:48 am    Post subject: Reply with quote

Hi Madan1582,

AFAIK, IBM PL/I for MVS & VM 1.1 will not support TRIM Function. You need to write a Trim functionality as subroutine.

Only Enterprise PL/1 supports TRIM function.
Back to top
View user's profile Send private message
ravindrakolluru
Beginner


Joined: 25 Sep 2007
Posts: 1
Topics: 0

PostPosted: Mon Oct 01, 2007 11:56 pm    Post subject: Reply with quote

I think the following needs to be done
1. The 2 files should be sorted in ascending order
2. To get the Variable1 (assuming it does not contain spaces in between), use VERIFY to get position of the SPACE, and then do a SUBSTR
eg: Variable1 = SUBSTR( FILE_REC, 1, VERIFY(FILE_REC,' ') - 1) ;

Then the algorithm would be:
1. READ File2,
2. READ File1
3. Get the Variable1 for both files to compare,
4. If File2.Var1 > File1.Var1 then read next record of File1
5. If File2.Var1 < File1.Var1 then read next record of File2
6. If File2.Var1 = File1.Var1 then write File2 to Output
7. Loop 3-6 until either file reaches EOF
8. Quit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group