View previous topic :: View next topic |
Author |
Message |
psmadhusudhan Beginner
Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Oct 28, 2009 8:33 am Post subject: Setting of RC by searching for some text fields in CSV file. |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Oct 28, 2009 10:04 am Post subject: |
|
|
psmadhusudhan,
DFSORT only lets you set RC=12, RC=4, or RC=0 _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
psmadhusudhan Beginner
Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Oct 28, 2009 10:16 am Post subject: |
|
|
oops
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 |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed Oct 28, 2009 10:59 am Post subject: |
|
|
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 |
|
|
psmadhusudhan Beginner
Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Oct 28, 2009 12:34 pm Post subject: |
|
|
I dont have EASYTRIEVE in our shop 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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Oct 28, 2009 1:23 pm Post subject: |
|
|
SAS or REXX seem like they might be better options. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Oct 28, 2009 1:50 pm Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Oct 28, 2009 2:03 pm Post subject: |
|
|
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 |
|
|
psmadhusudhan Beginner
Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Oct 28, 2009 8:42 pm Post subject: |
|
|
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 |
|
|
|
|