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
 

 

SORT Query with the next record
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 2:39 pm    Post subject: SORT Query with the next record
Reply with quote

Hi,

I got an issue and for that I need to delete records:
The criteria to drop the record if column 2-8 (which is actually date) should be less than 20130307. But the problem is I need to delete the next record of the matching criteria also.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Mar 07, 2013 2:43 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

what is that relates the <next> record to the one with the data ?
( just the position or they have some data which relates them )
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 2:55 pm    Post subject:
Reply with quote

actually the record is tool ong and it continues to the next record.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 07, 2013 2:57 pm    Post subject:
Reply with quote

Have you considered giving us some useful information to work with, including and example of the data.

Will this be for every sing occurence or selective occurences.

The more detail you give the more likely you are to get a good response
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 3:18 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

RECFM, LRECL, length of "too long" records, sample input, expected output.

You can probably do it with WHEN=GROUP,BEGIN=( and your or start,lenght,type,EQ,date ),RECORDS=2,and PUSH a marker to indicate that OUTFIL INCLUDE/OMIT should ignore it, but details depend on what you can give us.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 3:20 pm    Post subject:
Reply with quote

Hi Expat,
there is a abend in which the i/p file contain records which has the transaction date for jan and feb also. If I am deleting those records then my program is going in loop for the next record of the record deleted. Only similar thing in between those back to back record is the transaction id as both the record belong to same transaction and I dont have the transacti. When I am deleting the first record then the 2nd record should also be deleted but the second record dont have the date field.
For example:
Code:
----+----1----+----2----+----
*****************************
0106601643020200001000[color=darkblue]0207[/color]095
1006601643021122<?xml version


the higlighted one is the date field.and the transaction id is from column 3-12
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 3:25 pm    Post subject:
Reply with quote

didnt realised if I will highlight the format will change.

Please check below:
Code:
----+----1----+----2----+----
*****************************
01066016430202000010000207095
1006601643021122<?xml version


column 3-12 is tran-id and column 23-26 is date in mmdd format.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 3:31 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

OK, more questions for you to not get to answering yet.

Is the tran-id always the same?

Are there any records from a previous year, which would be valid and not require deleting, on the file?
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 3:32 pm    Post subject:
Reply with quote

Yes the transaction id for both the record will be same but I dont know the transaction id.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 3:50 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

OK, can you read back through all the questions and answer them?

More.

Is there only one "record-type" on the file (plus its extension) or might there be the chance of a "false hit" at the position of the date?

Are there no valid records for the January/February dates you mention?
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 4:01 pm    Post subject:
Reply with quote

RECFM=VB,RECL=2052. There will be no false hit for the date position but the second record dont have date.
I didnt understood the below one:
Quote:
Is there only one "record-type" on the file
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 07, 2013 4:12 pm    Post subject:
Reply with quote

Would it not be easier to amend the actual program that abends to reject the invalid data, report on the invalid data for reference, and thus remove the need to constantly apply fixes to the data ?

Just a thought.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 5:05 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

You describe the first record, then the second record being a "continuation" of the first.

Are all the records on the file like that, being in "pairs", with each of the pair having its own "structure"?

So, there would be no "single" records on the file, nothing other than these "pairs" all in the same format, but some being "OK", and some being incorrect.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 5:14 pm    Post subject:
Reply with quote

No there is one more indicator and if the indicator is one then the records are in paired and if it is 0 then it is single record.
But I can't pair it as the second record of the paired record don't have any specific value at the indicator place.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 5:19 pm    Post subject:
Reply with quote

the indicator position is 145-146
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 5:28 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

Goodness. Can there be a clash with the value indicator on the "second" record. Ie, is the second record able to give a "false hit" for a pair?

You must have a program which reads the file. What logic does that program use?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 07, 2013 5:56 pm    Post subject:
Reply with quote

expat wrote:
Would it not be easier to amend the actual program that abends to reject the invalid data, report on the invalid data for reference, and thus remove the need to constantly apply fixes to the data ?

Just a thought.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 157
Location: South Africa

PostPosted: Thu Mar 07, 2013 7:00 pm    Post subject:
Reply with quote

The program change done and the job went through... But now from out of box whether this is possible with SORT.
I will put the program conditions.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Mar 07, 2013 7:09 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

Quote:
But now from out of box whether this is possible with SORT.


we might tell if the rules were clearly defined ...

once upon a time
there were two records with the same key and the first one contained a date

but
Quote:
No there is one more indicator and if the indicator is one then the records are in paired and if it is 0 then it is single record.
But I can't pair it as the second record of the paired record don't have any specific value at the indicator place.

completely fogged up the explanation

the main question is ...

is there a way to identify the first record ???
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Mar 07, 2013 8:23 pm    Post subject: Reply to: SORT Query with the next record
Reply with quote

It very probably can be done with DFSORT, but we'd need all the information, including some sample data showing the conditions (pairs, singles, good dates, bad dates), and the expected output.

Is the file so badly designed that there is no way of identifying the "first" record of a single-or-pair group, without doing so "implicitly", as in "you know for the first data record on the file, and then hope to keep up with the thing via the single/pair indicator"? It can still be done, but, like anything else reading such a file it is a very "insecure" way to do it, as you really have to hope that the marker is correct.

Knowing "this bit of data tells us record 1, this bit of data tells us record 2", allows the marker to be validated, so you know immediately if the file "goes up the wall". Without that, if the marker is ever wrong, records from the file will be "lost" for as long as it takes for someone to "notice" it.
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
Goto page 1, 2  Next
Page 1 of 2

 

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 How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm


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