Multiple Conditions to Copy a File

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Multiple Conditions to Copy a File

Post by raulravi » Mon Jan 07, 2013 12:23 pm

I have a File as below

Code: Select all

"00","01082012","070516","RBSSUAMIR"
"01","1000009917","1234001","User 001"
"01","1000010059","1234017","User 022"
"01","1000009955","1234007","User 007"
"01","1000009964","1234008","User 008"
"01","1000009986","1234010","User 012"
"99","01082012","070516","RBSSUAMIR"
I want to copy file only when all the below conditions satisfy:

1) It has got the Header & Footer records
"00" from Col 1 to 4
"99" from Col 1 to 4

2) And rest all the records in the input file must have "01", in the first five positions.

Can we do this is one single sort card?

Thanks,
Raul

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Jan 07, 2013 3:04 pm

The first part is very easy, the second part I don't understand as it would seem to "overlap" with the first pat.

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Mon Jan 07, 2013 3:22 pm

OK let me put it clearly

I want to copy the file if it is like this

Code: Select all

"00","01082012","070516","RBSSUAMIR" 
"01","1000009917","1234001","User 001" 
"01","1000010059","1234017","User 022" 
"01","1000009955","1234007","User 007" 
"01","1000009964","1234008","User 008" 
"01","1000009986","1234010","User 012" 
"99","01082012","070516","RBSSUAMIR"
Dont copy when it is corrupted like this:

Code: Select all

"00","01082012","070516","RBSSUAMIR" 
01"1000009917","1234001","User 001" 
01"1000010059","1234017","User 022" 
"01","1000009955","1234007","User 007" 
"01","1000009964","1234008","User 008" 
"01"10000099861234010","User 012" 
"99","01082012","070516","RBSSUAMIR"
Dont copy when there is no footer record:

Code: Select all

"00","01082012","070516","RBSSUAMIR" 
"01","1000009917","1234001","User 001" 
"01","1000010059","1234017","User 022" 
"01","1000009955","1234007","User 007" 
"01","1000009964","1234008","User 008" 
"01","1000009986","1234010","User 012"

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Jan 07, 2013 4:47 pm

Ah, you want to do a file validation and conditional copy? Now, where did I put that...

Here it is...

http://www.mainframegurukul.com/ibmmain ... 7141#17141

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Mon Jan 07, 2013 6:20 pm

Dear William,

As i said earlier, i am scared and confused with that complex code. Can you help me out with some simple one.

Regards,
Raul

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Jan 07, 2013 7:54 pm

Sorry, didn't realise it was you :-)

If you want to do it in Sort, it is something like that. If you don't feel confident with it, then it'll have to be a program.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Jan 07, 2013 10:32 pm

If you are "scared and confused" by the referenced code, suggest you go ahead and write a little program to do this.

Think of the situation if the provided example was running on hyour system and then no one could maintain it.

Better to have the code that most will understand.

How many "sets" of data (hdr/dtl/ftr) could be in the input?
Have a good one

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 9:48 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others