Page 2 of 3

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 12:13 pm
by BillyBoyo
You need to change that INCLUDE= to an OMIT= to test for space at the start of the extended record. Or change the code to PUSH a SEQ not an ID and INCLUDE= for two. Then you don't need the SECTIONs anyway.

Any records you don't want from the original input, you use INCLUDE COND=/OMIT COND=. Any records you don't want after they have arrived at OUTFIL processing, you use INCLUDE=/OMIT=.

You need to go through that Getting Started guide.

PS. I see I was answering a different question earlier. Sorry about that. You don't need the '/' operator at all here, as you are turning two into one (where two exist as a pari) not splitting one into two... so it's even simpler. The BUILD you need to just to rearrange the data how you want it and to ingore the extened SEQ-field.

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 12:53 pm
by venubhat
will this work??

INCLUDE=(70:SEQ=2) or anything else need to be added..tried OMIT from OUTFIL to test for spaces so that can remove them but wasn't successful.

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 1:00 pm
by BillyBoyo
Where did you test for space? You need to test a byte (or more) of where the data from a previous record has been PUSHed to.

Without seeing the control cards you are using, I don't know where that is.

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 1:31 pm
by venubhat
here is my cntl card

OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(7,5,CH,EQ,C'ADMIN'),
END=(7,4,CH,EQ,C'USER'),
PUSH=(34:7,26,70:ID=1))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(70,1,TRAILER3=(1,5,34,26,X,7,26)),
OMIT=(7,5,CH,EQ,C' ')

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 2:46 pm
by BillyBoyo
 OPTION COPY
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(7,5,CH,EQ,C'ADMIN'),
                          END=(7,4,CH,EQ,C'USER'),
                          PUSH=(34:7,26,70:ID=1))
 OUTFIL REMOVECC,NODETAIL,
        SECTIONS=(70,1,TRAILER3=(1,5,34,26,X,7,26)),
        OMIT=(7,5,CH,EQ,C' ')


You PUSH the data to location 34, but OMIT= on column 7. Change the OMIT= to (34,5....

You no longer then have multiple records (where there is a pair of records) so you don't need SECTIONS. Since you don't need SECTIONS, you don't need REMOVECC or NODETAIL. You do need to rearrange the data, so you'll need a BUILD with the same content as your current TRAILER3.

As I've said, I'd use KEYBEGIN and PUSH a SEQ not an ID, and INCLUDE= for the SEQ-field being two and use BUILD to rearrange.

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 3:12 pm
by venubhat
thaknks billy that's working...!!!

have another Q in the same segment.

i/p
20006 ADMIN
20007 USER
20008 CUSTOMER
20006 AUTH

o/p
20006 ADMIN
20006 AUTH

basically when a rec i.e 20006 in this ex. has both ADMIN & AUTH only then it should be written to o/p file. if a rec has either only ADMIN or only USER or any other names should not be coming in o/p file. help in this regard is also much appreciated..

thanks
venu

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 3:29 pm
by Magesh23586
What is you try on this new requirement ?

Come up with your code.

Regards,
Magesh

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 3:39 pm
by venubhat
I tried the normal sort with OR cond so I get all records that have either ADMIN/AUTH but wanted only those rec which have both these..

thanks
venu

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 6:11 pm
by Magesh23586
Share your code to suggest.

Thanks
Magesh

Re: Select only paired records

PostPosted: Tue Jul 15, 2014 11:15 pm
by venubhat
code.....??? mean my sort card...??

SORT FIELDS=(1,8,CH,A)
INCLUDE COND=(9,5,CH,EQ,C'ADMIN'), OR, (9,4,CH,EQ,C'AUTH')

is that wht u wanted...

thanks
venu