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 

Setting of RC by searching for some text fields in CSV file.

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


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Oct 28, 2009 8:33 am    Post subject: Setting of RC by searching for some text fields in CSV file. Reply with quote

My input file is a csv(comma delimited) file and has three record types identified by texts "H01", "H02" and "D01" present on first three characters of each record.

There will be only one "H01" record per file, but multiple "H02" and "D01" records

Following logic should be done using DFSORT.


Code:

IF "file.rejected.excessive.record.errors" text is present anywhere in the entire file
   IF above text is present on "H01" record
      RC = 01
   ELSE
      IF above text is present on "H02" record
         RC = 02
      END-IF
   END-IF
ELSE
   IF "Non Fatal Error" text is present and "Fatal Error" text is not present
          RC = 03
   ELSE
      IF "Fatal Error" text is present
            RC = 04
      ELSE
          RC = 05
      END-IF
   END-IF
END-IF.


Can somebody please help me with the DFSORT sort card for getting above result.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 28, 2009 10:04 am    Post subject: Reply with quote

psmadhusudhan,

DFSORT only lets you set RC=12, RC=4, or RC=0
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Oct 28, 2009 10:16 am    Post subject: Reply with quote

oops Sad
actually based on above IF conditions I need to run some specified programs. So they thought I would generate some return code and based on that I would run the programs.

Is there any alternative solution for above problem.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Wed Oct 28, 2009 10:59 am    Post subject: Reply with quote

Given the DFSORT limitations (and likely the other SORT products, too), why not write an EASYTRIEVE or COBOL program to accomplish the task?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Oct 28, 2009 12:34 pm    Post subject: Reply with quote

I dont have EASYTRIEVE in our shop Sad and writing COBOL program for verifying above logic will become very complex I guess beacuse the text fields I am searching for might be present in any records and at any position in the file as the file type is csv.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Oct 28, 2009 1:23 pm    Post subject: Reply with quote

SAS or REXX seem like they might be better options.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 28, 2009 1:50 pm    Post subject: Reply with quote

psmadhusudhan,

Just wondering how do you check for this? "Fatal error" is found in the NON string which would make the second case impossible

Code:

IF "Non Fatal Error" text is present and "Fatal Error" text is not present

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Oct 28, 2009 2:03 pm    Post subject: Reply with quote

Quote:
above logic will become very complex I guess


Read a record
UNSTRING delimited by comma
compare (or if embedded within another string - a little ref mod routine)
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Oct 28, 2009 8:42 pm    Post subject: Reply with quote

kolusu,

Quote:

"Fatal error" is found in the NON string


you are correct, that is problem wiht this file. And the conditions under second case need different processing based on RC =03 and RC =04.
_________________
Thanks
Madhu Sudhan
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 -> Utilities 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