|
View previous topic :: View next topic
|
| Author |
Message |
Rajesh S Warnings : 1 New User

Joined: 11 Jul 2007 Posts: 54 Location: Chennai
|
|
|
|
Hi All,
These is a requirement to copy the records from input file to output file with below conditions
Input file contains 10 columns, we have to validate the records in 5 conditional columns for the spaces or zeroes and copy those records in to output file. In that, first unconditional column contains, employee ID, based on that, we have to omit 1 conditional column if it is spaces or zeroes.
Could anyone help on this?
Thanks in advance,
Rajesh S |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Perhaps if you explain in detail, giving examples of the input and expected output we may be able to offer some suggestions.
If there are different rules for different fields - Tell us now, all in one post.
We also need to know the DSORG, RECFM and LRECL of the files.
Also be aware that a column is a ONE byte field. Terminology is rather important in the IT game and it is very useful to use the correct terms. |
|
| Back to top |
|
 |
Rajesh S Warnings : 1 New User

Joined: 11 Jul 2007 Posts: 54 Location: Chennai
|
|
|
|
Hi,
Please find my requirement with examples.
Below input files 1 and 2 contains 7 columns, In that columns (3,4,5) are the conditional columns, We have to copy the records which contains spaces in conditional columns (3,4,5), and column-5 should omitted even it is spaces based on the column-1 value ‘55555’, Suppose if other 2 conditional columns are spaces, then that records should be captured in output file.
| Code: |
Input File -1:
COL-1 COL-2 COL-3 COL-4 COL-5 COL-6 COL-7
11111 DT 123456 0002 301720001 125812 HT25FG1315
22222 DT 659856 0006 301720002 125813 RE225FG133
33333 DT 125648 125814 225FG13272
44444 DT 0002 EW225FG27
55555 DT 256452 0002 125819 YT225FG13 |
| Code: |
Output File -1:
COL-1 COL-2 COL-3 COL-4 COL-5 COL-6 COL-7
33333 DT 125648 125814 225FG13272
44444 DT 0002 EW225FG27 |
| Code: |
Input File -2:
COL-1 COL-2 COL-3 COL-4 COL-5 COL-6 COL-7
11111 DT 123456 0002 301720001 125812 HT25FG1315
22222 DT 659856 0006 301720002 125813 RE225FG133
33333 DT 125648 125814 225FG13272
44444 DT 0002 EW225FG27
55555 DT 0002 125819 YT225FG13 |
| Code: |
Output File -2:
COL-1 COL-2 COL-3 COL-4 COL-5 COL-6 COL-7
33333 DT 125648 125814 225FG13272
44444 DT 0002 EW225FG27
55555 DT 0002 125819 YT225FG13 |
|
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Those are NOT columns but fields. Columns occur in tables i.e. DB2. Otherwise a column is a single byte as expat said but you ignored. |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Along with ignoring ...........
| expat wrote: |
| We also need to know the DSORG, RECFM and LRECL of the files. |
Also, we need the positions and lengths of the FIELDS |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I am a fan of pseudo-code in a case like this.
The TS could write the rules like this (for example):
| Code: |
IF FIELD-1 = '33333' THEN DO
IF FIELD-4 = SPACES OR FIELD-5 = SPACES THEN WRITE OUTOUT
END |
IF FIELD-1 = '44444' THEN DO....
Define your fields:
FIELD-1 is column 1 length 5
FIELD-4 is column 40 length 8
This could then easily be translated to SORT syntax
Probably too much to ask from them however.  |
|
| Back to top |
|
 |
Rajesh S Warnings : 1 New User

Joined: 11 Jul 2007 Posts: 54 Location: Chennai
|
|
|
|
Hi
Thanks expat, Nic, daveporcelan for your response.
Please find the below details for your request.
| Code: |
Input file details:
DSORG : PS
Record Format: FB
Record Length : 80
Block size: 800 |
| Code: |
OutPut file details:
DSORG : PS
Record Format: FB
Record Length : 80
Block size: 800 |
| Code: |
Fields Position Length
Field-1 1 5
Field-2 8 2
Field-3 12 6
Field-4 20 4
Field-5 26 9
Field-6 37 6
Field-7 45 10
|
[/code] |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
What about the pseudo code to better explain your rules?
To be honest, your verbal description does not work well enough for me. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
If I understand correctly you can use the following control cards
| Code: |
//SYSIN DD *
OPTION COPY
OMIT COND=((12,6,CH,GT,C' ',AND,
20,4,CH,GT,C' ',AND,
26,9,CH,GT,C' '),OR,
(01,5,CH,EQ,C'55555',AND,
12,6,CH,EQ,C' ',AND,
20,4,CH,GT,C' ',AND,
26,9,CH,GT,C' '),OR,
(01,5,CH,EQ,C'55555',AND,
12,6,CH,GT,C' ',AND,
20,4,CH,EQ,C' ',AND,
26,9,CH,GT,C' '),OR,
(01,5,CH,EQ,C'55555',AND,
12,6,CH,GT,C' ',AND,
20,4,CH,GT,C' ',AND,
26,9,CH,EQ,C' '))
//* |
or
| Code: |
//SYSIN DD *
OPTION COPY
INCLUDE COND=(12,6,CH,EQ,C' ',OR,
20,4,CH,EQ,C' ',OR,
26,9,CH,EQ,C' ')
OUTFIL OMIT=((01,5,CH,EQ,C'55555',AND,
12,6,CH,EQ,C' ',AND,
20,4,CH,GT,C' ',AND,
26,9,CH,GT,C' '),OR,
(01,5,CH,EQ,C'55555',AND,
12,6,CH,GT,C' ',AND,
20,4,CH,EQ,C' ',AND,
26,9,CH,GT,C' '),OR,
(01,5,CH,EQ,C'55555',AND,
12,6,CH,GT,C' ',AND,
20,4,CH,GT,C' ',AND,
26,9,CH,EQ,C' '))
//* |
|
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Kolusu to rescue once again. Thanks.
My request for Pseudo code was an attempt for the TS to use their brain and determine the logic needed on their own.
Oh well, better luck next time. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| daveporcelan wrote: |
Kolusu to rescue once again. Thanks.
My request for Pseudo code was an attempt for the TS to use their brain and determine the logic needed on their own.
Oh well, better luck next time. |
Dave,
I apologize for providing a complete solution. I agree with you about encouraging the posters to write psuedo code or work on solutions with clues provided, however very few people do that. |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
| Quote: |
Dave,
I apologize for providing a complete solution. I agree with you about encouraging the posters to write psuedo code or work on solutions with clues provided, however very few people do that.
|
No apology necessary.
The knowledge and service you provide is very valuable and appreciated.
What the people do with the information is questionable.
When a TS comes back with a silly adjustment or error, refusing to try to figure out, that is when the brakes should be applied. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|