Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Group option identifying all records of a project.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Jul 29, 2011 8:46 pm    Post subject: Group option identifying all records of a project.
Reply with quote

hi there,

I have a requirement to isolate to a separate file all 'new' projects that have been added to our system since the last time we ran an SAP database load. The data that comprises a project has items / keys that start in column 1 at 000 as the 'project to start record' then 100, 200, 300, 400 etc that make up the pieces of the project's task's. Since there can be any number of 100 , 200 etc records I am needing to get all of the keys between the 000 project description record and the next 000 record.
Data looks like:

Code:

000              |0000|0349|200|NS  |06 |FORESTPA         |GA | S2|          |
100              |0000|CN  |   |    |   |                 |   |   |          |
100              |0000|CSXT|   |    |   |                 |   |   |          |
100              |0000|CSXT|   |    |   |                 |   |   |          |
200              |0000|C   |GAU|    |   |                 |   |   |          |
200              |0000|D   |GE0|    |   |                 |   |   |          |
200              |0000|I   |GE0|    |   |                 |   |   |          |
300              |0000|0000|   |    |   |                 |   |   |          |
000              |0000|0267|200|NS  |03 |BRUSH            |IL | D3|ADM       |
100              |0000|ADMX|   |    |   |                 |   |   |          |
100              |0000|CNA |   |    |   |                 |   |   |          |
200              |0000|C   |GAU|    |   |                 |   |   |          |
200              |0000|I   |ADM|    |   |                 |   |   |          |
200              |0000|L   |CAR|    |   |                 |   |   |          |
300              |0000|0000|   |    |   |                 |   |   |          |
000              |0000|0195|200|NS  |12 |SHAFFERS         |VA | N2|          |
100              |0000|NS  |Y  |    |   |                 |   |   |          |
200              |0000|C   |REV|    |   |                 |   |   |          |
200              |0000|I   |MEC|    |   |                 |   |   |          |
300              |0000|0000|   |    |   |                 |   |   |          |


I am not real sharp on how GROUP and PUSH work with each other but it sounds like a perfect match for GROUP. Thanks.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Jul 29, 2011 8:52 pm    Post subject:
Reply with quote

Can you please show us expected output for above shown example...
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Jul 29, 2011 9:03 pm    Post subject:
Reply with quote

1st add

Code:

000              |0000|0198|200|NS  |11 |LUTTRELL         |TN |  0|GLOBAL STO|
100              |0000|ACFX|   |    |   |                 |   |   |          |
200              |0000|C   |SWI|    |   |                 |   |   |          |
200              |0000|I   |IND|    |   |                 |   |   |          |
300              |0000|0000|   |    |   |                 |   |   |          |


2nd add
Code:

000              |0000|0291|200|NS  |05 |MELVINDA         |MI | D0|CSXT      |
100              |0000|ITGX|   |    |   |                 |   |   |          |
100              |0000|ACFX|   |    |   |                 |   |   |          |
200              |0000|C   |RAI|    |   |                 |   |   |          |
200              |0000|I   |CSX|    |   |                 |   |   |          |
300              |0000|0000|   |    |   |                 |   |   |          |
[/code]
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jul 29, 2011 9:07 pm    Post subject:
Reply with quote

madmartinsonxx,
Do you have limit to maximum number of projects? By 1st add and 2nd add did you mean to write them to separate mainframe files.

Are you trying to create separate output files by splitting your input file, based on project.


Also, you show different input data in one post and and later in the next one you are showing expected output based on completely different input data.

Thanks,
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Jul 29, 2011 9:18 pm    Post subject:
Reply with quote

For 5 occurances of project records... Assuming LREL 80
Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD dsn=input dataset here               
//OF1      DD SYSOUT=*                               
//OF2      DD SYSOUT=*                               
//OF3      DD SYSOUT=*                               
//OF4      DD SYSOUT=*                               
//OF5      DD SYSOUT=*                               
//SYSIN    DD *                                       
 OPTION COPY,EQUALS                                   
 INREC IFTHEN=(WHEN=GROUP,                           
       BEGIN=(1,3,CH,EQ,C'000'),PUSH=(81:ID=8))       
 OUTFIL FNAMES=OF1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)
 OUTFIL FNAMES=OF2,INCLUDE=(81,8,ZD,EQ,2),BUILD=(1,80)
 OUTFIL FNAMES=OF3,INCLUDE=(81,8,ZD,EQ,3),BUILD=(1,80)
 OUTFIL FNAMES=OF4,INCLUDE=(81,8,ZD,EQ,4),BUILD=(1,80)
 OUTFIL FNAMES=OF5,INCLUDE=(81,8,ZD,EQ,5),BUILD=(1,80)
/* 
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Jul 29, 2011 9:30 pm    Post subject:
Reply with quote

sql,

right. didnt see the data anomally there. same input file though. and no i do not need separate files. just the 'new' project set of data, no matter how many there, written to one output file so the business guy can su** it up into a spreadsheet. 1st add and 2nd add was example to show that there could be several 100's , 200's 300's etc.

i will need to look at this PUSH=(81:ID=8)) to understand its implication. appears to be similiar to SEQNUM, but, i am just not sure. The BEGIN keyword rings a bell soundly though. That is something I will remember.

Cant golf today and this task is what my next step is in this lovely conversion mess and Thanks mucho again.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jul 29, 2011 9:42 pm    Post subject:
Reply with quote

madmartinsonxx,
Quote:
just the 'new' project set of data, no matter how many there, written to one output file so the business guy can suc* it up into a spreadsheet.

I am not sure what do you mean 'new' project set of data?
Quote:
i will need to look at this PUSH=(81:ID=8)) to understand its implication. appears to be similiar to SEQNUM, but, i am just not sure. The BEGIN keyword rings a bell soundly though. That is something I will remember.
PUSH is not simiar to SEQNUM except both are ZD. PUSH works at a group level and SEQNUM at a record level. In layman's terms, it basically assings unique id to each group (and to records which forms the group). Through BEGIN and END you define group.

Escapa,
Just for fun, I am wondering what would EQUALS do with OPTION COPY. icon_wink.gif

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jul 29, 2011 10:58 pm    Post subject:
Reply with quote

madmartinsonxx,

You need to explain what you mean by a "new project set of data". What are the programmatic rules for identify the groups of data you want vs the groups of data you don't want?

PUSH has several options that apply to the identified group. ID=n puts the same number in each record of the group (e.g. 0001 for all records of first group, 0002 for all records of second group, etc). SEQ=n puts a sequence number in each record of each group (e.g. 0001 for first record of first group, 0002 for second record of first group,...,0001 for first record of second group, 0002 for second record of second group, etc).

Quote:
Just for fun, I am wondering what would EQUALS do with OPTION COPY.


As you probably know, EQUALS is ignored with COPY since it has no meaning for COPY.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jul 29, 2011 11:17 pm    Post subject:
Reply with quote

Frank,
This was intended to add some humor, nothing serious at all. I was more than certain that Escapa knew it as well.

Next time onwards, I will make it a point to write PM for something not related to answering post.

Thanks,
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Jul 29, 2011 11:25 pm    Post subject:
Reply with quote

Quote:

You need to explain what you mean by a "new project set of data".


Good question. Thank you, my bad.

I have 2 files of same layout and lrecl (as above). F1 has last weeks projects set's of data. F2 has the F1 data records AND new projects which were entered data records. The 000 in column 1 is the start of a project's set of data. If the 000 record is in F2ONLY then it is considered an ADD / NEW project along with it's associated data 100, 200 etc records.
If i had another field which i could KEY off of along with the 000, 100 KEY I would be in fat city. But, I don't. Thats why the inquiry into the GROUP function which I felt was appropriate.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jul 29, 2011 11:50 pm    Post subject:
Reply with quote

madmartinsonxx,
What makes project unique? Do you have something like unique project id? What is LRECL and RECFM of the input file?

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jul 29, 2011 11:58 pm    Post subject:
Reply with quote

mad,

You never mentioned that you have two files before. That's different and we still don't have a clear picture of what you're trying to do.

So please start over and give a better explanation and example of what you need.

Show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Jul 29, 2011 11:59 pm    Post subject:
Reply with quote

Quote:

What makes project unique? Do you have something like unique project id?





recfm=fb, lrecl=133

what makes project unique is that the entire 000 record, all 133 bytes, that appears in F2 does not exist in F1 at all. When that flag is raised all of the other 100, 200 etc records are a part of the NEW 000 record until I get the next 000 record then the party starts anew.[/quote]
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Jul 30, 2011 12:00 am    Post subject:
Reply with quote

i will do what Frank asked when i come back from this project meeting.
bbiab.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Jul 30, 2011 12:00 am    Post subject:
Reply with quote

Quote:
Frank,
This was intended to add some humor, nothing serious at all. I was more than certain that Escapa knew it as well.

Next time onwards, I will make it a point to write PM for something not related to answering post.


Yes, I knew it was a joke. But I was worried that some people wouldn't know about EQUALS and COPY so I thought I better explain it for those people.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us