Problem in creating sequence

Author Message
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

Posted: Mon Jan 20, 2014 7:22 pm

I am using below sort card

 Code: INCLUDE COND=(39,04,CH,EQ,C'NOUS')                                   SORT FIELDS=(214,1,CH,A,215,1,CH,A)                                   INREC IFTHEN=(WHEN=(34,4,CH,EQ,C'5793'),OVERLAY=(214:C'1')),               IFTHEN=(WHEN=(34,4,CH,EQ,C'5493'),OVERLAY=(214:C'2')),               IFTHEN=(WHEN=(34,4,CH,EQ,C'5003'),OVERLAY=(214:C'3')),               IFTHEN=(WHEN=NONE,OVERLAY=(214:C'4'))                          *                                                                     INREC IFTHEN=(WHEN=(44,06,CH,GT,C'000000',OR,44,06,CH,GT,C'060060')        OVERLAY=(215:C'1')),                                                 IFTHEN=(WHEN=(44,06,CH,GT,C'200000',OR,44,06,CH,GT,C'299999')        OVERLAY=(215:C'2')),                                                 IFTHEN=(WHEN=(44,06,CH,GT,C'100000',OR,44,06,CH,GT,C'101608')        OVERLAY=(215:C'3'))                                                   IFTHEN=(WHEN=NONE,OVERLAY=(215:C'4'))                           OUTREC BUILD=(1,213)

In the above sort card i have created the sequence of records using IFTHEN for 5793,5493,5003 and its working.

But now i want to create sequence of(pos 44 lenght 6) already sorted date based on some range hence i am using the second IFTHEN but its showing
" DUPLICATE OR CONFLICTING INREC STATEMENT "
Pandora-Box

Global Moderator

Joined: 07 Sep 2006
Posts: 1590
Location: Andromeda Galaxy

Posted: Mon Jan 20, 2014 8:10 pm

Hi,

You are having 2 INREC IFTHEN

 Code: INREC IFTHEN=(WHEN=(34,4,CH,EQ,C'5793'),OVERLAY=(214:C'1')),        . . .                  *                                                                     INREC IFTHEN=(WHEN=(44,06,CH,GT,C'000000',OR,44,06,CH,GT,C'060060')        OVERLAY=(215:C'1')),
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

 Posted: Mon Jan 20, 2014 8:12 pm but without that how can i achieve the second sort sequence
Pandora-Box

Global Moderator

Joined: 07 Sep 2006
Posts: 1590
Location: Andromeda Galaxy

Posted: Mon Jan 20, 2014 8:16 pm

Can't you combine them both like

 Code: INREC IFTHEN=(WHEN=(34,4,CH,EQ,C'5793',AND,(44,06,CH,GT,C'000000',OR,44,06,CH,GT,C'060060')),
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

Posted: Mon Jan 20, 2014 8:26 pm

 Code: IFTHEN=(WHEN=(44,06,CH,GT,C'000000',OR,44,06,CH,GT,C'060060')        OVERLAY=(215:C'1')),                                                 IFTHEN=(WHEN=(44,06,CH,GT,C'200000',OR,44,06,CH,GT,C'299999')        OVERLAY=(215:C'2')),                                                 IFTHEN=(WHEN=(44,06,CH,GT,C'100000',OR,44,06,CH,GT,C'101608')        OVERLAY=(215:C'3'))                                                   IFTHEN=(WHEN=NONE,OVERLAY=(215:C'4'))

Your conditions are confusion. What are you trying to do? Each of the second part of the OR is already covered by the first part.

You can only have one INREC, but you can have lots of IFTHENs on an INREC (or OUTREC or OUTFIL).

The IFTHEN=(WHEN=(logexp processing stops when one is satisfied. To take two different conditions on a single record into account you'll have to look at HIT=NEXT, but work out what you want your IFTHENs to say first.
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

 Posted: Mon Jan 20, 2014 11:08 pm Thanks Pandora and bill for your replies Sorry i have used wrong conditions second one is LT But if i want to check for both inclusive value that is from range 000000 to 060060 for first ifthen 200000 to 299999 for second Ifthen and so on then which operators i should use
Skolusu

Senior Member

Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

Posted: Tue Jan 21, 2014 3:59 am

Look up the keyword HIT=NEXT and you should be able to get the desired results. Understand the code given instead of blindly copying it and you will be able to modify it for future design changes.

something like this

 Code: //SYSIN    DD *                                                      INCLUDE COND=(39,4,CH,EQ,C'NOUS')                                                                                                  INREC IFTHEN=(WHEN=INIT,OVERLAY=(214:C'44')),                      IFTHEN=(WHEN=(34,4,CH,EQ,C'5793'),OVERLAY=(214:C'1'),HIT=NEXT),   IFTHEN=(WHEN=(34,4,CH,EQ,C'5493'),OVERLAY=(214:C'2'),HIT=NEXT),   IFTHEN=(WHEN=(34,4,CH,EQ,C'5003'),OVERLAY=(214:C'3'),HIT=NEXT),   IFTHEN=(WHEN=(44,6,CH,GT,C'000000',OR,44,6,CH,LT,C'060060'),         OVERLAY=(215:C'1')),                                          IFTHEN=(WHEN=(44,6,CH,GT,C'200000',OR,44,6,CH,LT,C'299999'),         OVERLAY=(215:C'2')),                                          IFTHEN=(WHEN=(44,6,CH,GT,C'100000',OR,44,6,CH,LT,C'101608'),         OVERLAY=(215:C'3'))                                                                                                            SORT FIELDS=(214,1,CH,A,215,1,CH,A)                                                                                                  OUTREC BUILD=(1,213)                                            //*
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

Posted: Tue Jan 21, 2014 3:09 pm

 Code: *INCLUDE COND=(39,04,CH,EQ,C'NOUS')                                     *     SORT FIELDS=(214,1,CH,A,215,1,CH,A)                                     SORT FIELDS=(214,1,CH,A)                                                  INREC IFTHEN=(WHEN=INIT,OVERLAY=(214:C'44')),                            IFTHEN=(WHEN=(34,4,CH,EQ,C'5525'),OVERLAY=(214:C'1'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5526'),OVERLAY=(214:C'2'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5122'),OVERLAY=(214:C'3'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5513'),OVERLAY=(214:C'4'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,NE,C'5525',OR,34,4,CH,NE,C'5526',OR,                            34,4,CH,NE,C'5122',OR,34,4,CH,NE,C'5513'),                                    OVERLAY=(214:C'5'))

When i am using above code i am getting only 5 at col 214 eevn though 5525,5526 records are present
sureshpathi10

Active User

Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

Posted: Tue Jan 21, 2014 3:48 pm

I don't understand what are you trying to do... but anyway...

 Code: IFTHEN=(WHEN=(34,4,CH,NE,C'5525',OR,34,4,CH,NE,C'5526',OR,                            34,4,CH,NE,C'5122',OR,34,4,CH,NE,C'5513'),                                    OVERLAY=(214:C'5'))

the above OVERLAY will override the data of position 214 populated by below code
 Code: IFTHEN=(WHEN=(34,4,CH,EQ,C'5525'),OVERLAY=(214:C'1'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5526'),OVERLAY=(214:C'2'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5122'),OVERLAY=(214:C'3'),HIT=NEXT),         IFTHEN=(WHEN=(34,4,CH,EQ,C'5513'),OVERLAY=(214:C'4'),HIT=NEXT),

Becuase, you've mentioned 'NE' and 'OR', So all the data will fall into this. Please try to understand and code. We've already discussed here.

If you still want to try with your code use this
 Code: IFTHEN=(WHEN=(34,4,CH,NE,C'5525',AND,34,4,CH,NE,C'5526',AND,                            34,4,CH,NE,C'5122',AND,34,4,CH,NE,C'5513'),                                    OVERLAY=(214:C'5'))
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

Posted: Tue Jan 21, 2014 3:53 pm

Thanks Suresh

Below is corrected one

 Code: *INCLUDE COND=(39,04,CH,EQ,C'NOUS')                                             SORT FIELDS=(214,1,CH,A,215,1,CH,A)                                        INREC IFTHEN=(WHEN=INIT,OVERLAY=(214:C'56')),                            IFTHEN=(WHEN=(34,4,CH,EQ,C'5525'),OVERLAY=(214:C'1'),HIT=NEXT),          IFTHEN=(WHEN=(34,4,CH,EQ,C'5526'),OVERLAY=(214:C'2'),HIT=NEXT),          IFTHEN=(WHEN=(34,4,CH,EQ,C'5122'),OVERLAY=(214:C'3'),HIT=NEXT),          IFTHEN=(WHEN=(34,4,CH,EQ,C'5513'),OVERLAY=(214:C'4'),HIT=NEXT)  *      IFTHEN=(WHEN=(34,4,CH,NE,C'5525',OR,34,4,CH,NE,C'5526',OR,         *                    34,4,CH,NE,C'5122',OR,34,4,CH,NE,C'5513'),           *                          OVERLAY=(214:C'5'))
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

 Posted: Tue Jan 21, 2014 3:55 pm It is very hard to keep up when you keep changing things. That is because you have told it to. IF ( A NE B ) OR ( A NE C ) will always be true, because A can only have one value, so is either not equal to one of the values, or both. If you are trying to say "it is not one of the above" then you can look at WHEN=INIT to set an initial value ("5") or WHEN=NONE. Your second set of IFTHENs are again missing. If they are to return, ensure you run thru what you want. What you showed previously still does not make sense, although Kolusu has shown you how to implement it anyway. Seems from your latest that you were just wasting his time.
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

Posted: Tue Jan 21, 2014 4:24 pm

Sorry Bill.
But now i got data as per requirement.
Thanks to all for your help.Here is my working sort card

 Code: SORT FIELDS=(214,1,CH,A,215,1,CH,A)                                INREC IFTHEN=(WHEN=INIT,OVERLAY=(214:C'56')),                    IFTHEN=(WHEN=(34,4,CH,EQ,C'5525'),OVERLAY=(214:C'1'),HIT=NEXT),   IFTHEN=(WHEN=(34,4,CH,EQ,C'5526'),OVERLAY=(214:C'2'),HIT=NEXT),   IFTHEN=(WHEN=(34,4,CH,EQ,C'5122'),OVERLAY=(214:C'3'),HIT=NEXT),   IFTHEN=(WHEN=(34,4,CH,EQ,C'5513'),OVERLAY=(214:C'4'),HIT=NEXT),                                                                                                                                       IFTHEN=(WHEN=((44,06,ZD,GT,000000,AND,44,06,ZD,LT,060066),                  OR,(44,06,ZD,GT,063967,AND,44,06,ZD,LT,100000)),        OVERLAY=(215:C'1')),                                                                                                                IFTHEN=(WHEN=(44,06,ZD,GT,200000,AND,44,06,ZD,LT,299999),        OVERLAY=(215:C'2')),                                             IFTHEN=(WHEN=((44,06,ZD,GT,100000,AND,44,06,ZD,LT,101608),                   OR,(44,06,ZD,GT,100000,AND,44,06,ZD,LT,101609),                   OR,(44,06,ZD,GT,101709,AND,44,06,ZD,LT,170205),                   OR,(44,06,ZD,GT,170306,AND,44,06,ZD,LT,199999)),         OVERLAY=(215:C'3')),                                                                                                                 IFTHEN=(WHEN=((44,06,ZD,GT,300000,AND,44,06,ZD,LT,349999),                   OR,(44,06,ZD,GT,420000,AND,44,06,ZD,LT,429999),                   OR,(44,06,ZD,GT,500000,AND,44,06,ZD,LT,569999),                   OR,(44,06,ZD,GT,620000,AND,44,06,ZD,LT,659999)),         OVERLAY=(215:C'4')),                                                                                                                 IFTHEN=(WHEN=(44,06,ZD,GT,350000,AND,44,06,ZD,LT,350999),         OVERLAY=(215:C'5'))                                                                                                                OUTREC BUILD=(1,213)
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

 Posted: Tue Jan 21, 2014 4:36 pm Are you sure of GT and LT rather than GE and LE?
trushant.w

New User

Joined: 22 Sep 2013
Posts: 81
Location: pune india

 Posted: Tue Jan 21, 2014 4:45 pm yes thats the range i need to check
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics problem in select max when executing ... IMS DB/DC 6 Sysncsort - Justification problem SYNCSORT 6 XML Parsing in COBOL creating "h... COBOL Programming 0 Creating additional seqnum/Literal wh... DFSORT/ICETOOL 4 Creating a single-record file with CO... DFSORT/ICETOOL 8
Search our Forums: