IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Build two or more rows given some condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 2:16 pm
Reply with quote

Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.

------

I tried to use the next expression:

Code:
OUTREC IFTHEN=(WHEN=(56,1,CH,EQ,C'1),
                       BUILD=(C'1',C'02'),
                       BUILD=(C'1',C'03'))


With this I intended to if that condition was satisfied two rows were to be created. But it does not work.

Please can anybody give me a hand with this.

Thank you
Greetings.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 563
Location: Bamberg, Germany

PostPosted: Thu Apr 08, 2021 2:19 pm
Reply with quote

Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code,Data and/or Error Msgs (see Button named 'Code' that works as a toggle).

If you want to create multiple lines from a single input line, use OUTFIL and not OUTREC. See / for line break in a single coded BUILD statement.
Back to top
View user's profile Send private message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 2:25 pm
Reply with quote

Joerg.Findeisen wrote:
Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code and/or Data (see Button named 'Code' that works as a toggle).


Thanks for your attention.
For example if I have the next input

AABB1333
AACC4321

If the condition is

Code:
OUTREC IFTHEN=(WHEN=(2,2,CH,EQ,C'AB')


My desired output should be:

AB ID IS FOREIGNER
AB PRICE IS 1333

As I said earlier my intention was to use a double BUILD, each one for each new row when the condition was satisfied, but that did not work.

Thank you again, in the meanwhile I will add the tags.
Back to top
View user's profile Send private message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 2:32 pm
Reply with quote

I will investigate this / keyword, Thank you, I did not see that part of your messagge before.
Back to top
View user's profile Send private message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 3:01 pm
Reply with quote

Joerg.Findeisen wrote:
Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code,Data and/or Error Msgs (see Button named 'Code' that works as a toggle).

If you want to create multiple lines from a single input line, use OUTFIL and not OUTREC. See / for line break in a single coded BUILD statement.


This keyword / worked well.
This problem is solved.
Thank you again.
Back to top
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1139

PostPosted: Thu Apr 08, 2021 5:36 pm
Reply with quote

Ali_gezer wrote:
Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.

------

I tried to use the next expression:

Code:
OUTREC IFTHEN=(WHEN=(56,1,CH,EQ,C'1),
                       BUILD=(C'1',C'02'),
                       BUILD=(C'1',C'03'))


With this I intended to if that condition was satisfied two rows were to be created. But it does not work.

Please can anybody give me a hand with this.

Thank you
Greetings.

1) The questions in the style “it does not work” only - they are not accepted at this forum
2) Please, check the syntax rules for IFTHEN operand, and for BUILD operand too, using any SORT manual, and follow those rules carefully. Do not use other rules except those of SORT utility.
Back to top
View user's profile Send private message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 6:11 pm
Reply with quote

sergeyken wrote:
Ali_gezer wrote:
Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.

------

I tried to use the next expression:

Code:
OUTREC IFTHEN=(WHEN=(56,1,CH,EQ,C'1),
                       BUILD=(C'1',C'02'),
                       BUILD=(C'1',C'03'))


With this I intended to if that condition was satisfied two rows were to be created. But it does not work.

Please can anybody give me a hand with this.

Thank you
Greetings.

1) The questions in the style “it does not work” only - they are not accepted at this forum
2) Please, check the syntax rules for IFTHEN operand, and for BUILD operand too, using any SORT manual, and follow those rules carefully. Do not use other rules except those of SORT utility.


I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.

Thanks.
Back to top
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1139

PostPosted: Thu Apr 08, 2021 6:29 pm
Reply with quote

Ali_gezer wrote:

I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.

Thanks.

How did you try to look for it??? It took me about 15 seconds to find the first of each one:
Quote:
IFTHEN clauses:

Reformat different records in different ways by specifying how build, overlay, find/replace, or group operation items are applied to records that meet given criteria.

IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted.

Example:
Code:
INREC/OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE1'),
            BUILD=(1,40,C'**',+1,TO=PD)),
      IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE2'),
            BUILD=(1,40,+2,TO=PD,X'FFFF')),
      IFTHEN=(WHEN=NONE,OVERLAY=(45:C'NONE'))


Quote:
/.../ or n/

Blank lines or a new line. A new report record is to be started in the output record, with or without intervening blank lines.

If /.../ or n/ is specified at the beginning or end of the output record, n blank lines are to appear in the record.

If /.../ or n/ is specified in the middle of the trailer, n-1 blank lines are to appear in the record (thus, / or 1/ indicates a new line with no intervening blank lines).

Either n/ (for example, 5/) or multiple /'s (for example, /////) can be used. n can range from 1 to 255.

If n is omitted, 1 is used.
Back to top
View user's profile Send private message
Ali_gezer

New User


Joined: 06 Apr 2021
Posts: 48
Location: argentina

PostPosted: Thu Apr 08, 2021 11:35 pm
Reply with quote

sergeyken wrote:
Ali_gezer wrote:

I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.

Thanks.

How did you try to look for it??? It took me about 15 seconds to find the first of each one:
Quote:
IFTHEN clauses:

Reformat different records in different ways by specifying how build, overlay, find/replace, or group operation items are applied to records that meet given criteria.

IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted.

Example:
Code:
INREC/OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE1'),
            BUILD=(1,40,C'**',+1,TO=PD)),
      IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE2'),
            BUILD=(1,40,+2,TO=PD,X'FFFF')),
      IFTHEN=(WHEN=NONE,OVERLAY=(45:C'NONE'))


Quote:
/.../ or n/

Blank lines or a new line. A new report record is to be started in the output record, with or without intervening blank lines.

If /.../ or n/ is specified at the beginning or end of the output record, n blank lines are to appear in the record.

If /.../ or n/ is specified in the middle of the trailer, n-1 blank lines are to appear in the record (thus, / or 1/ indicates a new line with no intervening blank lines).

Either n/ (for example, 5/) or multiple /'s (for example, /////) can be used. n can range from 1 to 255.

If n is omitted, 1 is used.


Yes, later with the help of the friend of the top of page with that keyword I could investigate this and achieve the resolution, but the manual of sort is kind of big and I was kind of sure that doing something with the build command I could in some way reach the solution, thats why I asked here because there are people who knows very deeply this kind of commands.

I don't want to noone to make my work, but I asked only a clue or some word to investigate and fortunetly this person helped me well.

Thanks again to all.

ps: congrats for you 1000 messages
Back to top
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1139

PostPosted: Thu Apr 08, 2021 11:57 pm
Reply with quote

Ali_gezer wrote:
Yes, later with the help of the friend of the top of page with that keyword I could investigate this and achieve the resolution, but the manual of sort is kind of big and I was kind of sure that doing something with the build command I could in some way reach the solution, thats why I asked here because there are people who knows very deeply this kind of commands.

I don't want to noone to make my work, but I asked only a clue or some word to investigate and fortunetly this person helped me well.

The full manual is probably big. But in your case you've got just a syntax error (which you refused to mention in your post). The syntax error is related to a minor single parameter of SORT utility; the whole syntax explanation of it is only a few lines of the manual (and most of them are quoted in my response). If you do not see the difference between "it did not work", and "syntax error in SSS parameter", - that makes the whole situation even worse.

You were not able to verify your own code against the detailed syntax description in the manual (even after getting the clear message about SYNTAX ERROR IN ...this... PARAMETER). That's a pity, with no difference what you've had in your mind... icon_cry.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
No new posts Write records with 3 or less rows in ... DFSORT/ICETOOL 3
No new posts Dynamic condition checks COBOL Programming 5
No new posts Extract 2 more lines below line that ... DFSORT/ICETOOL 2
No new posts Reading subsequent rows in a query. DB2 12
Search our Forums:

Back to Top