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

JCL sortcard to print only the records


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

New User


Joined: 21 Jun 2023
Posts: 4
Location: India

PostPosted: Wed Jun 21, 2023 11:29 am
Reply with quote

Hi
I need to a JCL sortcard that prints only the records that has mj kl ll in the input if there is no such record in input it should print a new line in output that has mj kl ll and 0000 .

Thanks
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jun 21, 2023 12:03 pm
Reply with quote

Either JCL or SORT. Provide proper input test data, and desired output. Consider using code tags when presenting any code or data.

What have you tried yourself to meet the requirement?
Back to top
View user's profile Send private message
Kittu1

New User


Joined: 21 Jun 2023
Posts: 4
Location: India

PostPosted: Wed Jun 21, 2023 12:20 pm
Reply with quote

I have tried using this
SORT FIELDS=(1,2,CH,A)
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'MJ KL LL'),
BUILD=(1,8,13:13,10)),
OTHERWISE=(BUILD=(1:C'MJ KL LL',13:C'0000'))


INPUT DATA SET LOOKS LIKE THIS

MJ KI LL 0000001234
MJ KT LL 0000001154
NI KL LL 0000007684

In i/p ps file as the record is not present , i am expecting

MJ KL LL 0000
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2051
Location: USA

PostPosted: Wed Jun 21, 2023 5:22 pm
Reply with quote

1. Please, learn how to post your messages:
Kittu1 wrote:
I have tried using this
Code:
 SORT FIELDS=(1,2,CH,A)
 INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'MJ KL LL'),
                        BUILD=(1,8,13:13,10)),
           OTHERWISE=(BUILD=(1:C'MJ KL LL',13:C'0000'))


INPUT DATA SET LOOKS LIKE THIS
Code:
MJ KI LL    0000001234
MJ KT LL    0000001154
NI KL LL    0000007684


In i/p ps file as the record is not present , i am expecting
Code:
MJ KL LL     0000


2. What are the results of your attempts?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jun 21, 2023 5:37 pm
Reply with quote

It is not fully clear to me. If the record is not present, there is only that one line in the output? Or, if the record is not present, it should be added and other records are left untouched for the output?
Back to top
View user's profile Send private message
Kittu1

New User


Joined: 21 Jun 2023
Posts: 4
Location: India

PostPosted: Wed Jun 21, 2023 6:15 pm
Reply with quote

After running the JCL, the output file is having all the records present in input file. But , my output should be having single record
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2051
Location: USA

PostPosted: Wed Jun 21, 2023 7:32 pm
Reply with quote

Kittu1 wrote:
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record

My expectation is, you MUST get the message "SYNTAX ERROR", did you get it?

Always present the exact copy of your results, and messages.
Do not tell here only the fairy tales about your runs!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jun 21, 2023 9:22 pm
Reply with quote

Kittu1 wrote:
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record

That means your output is NOT the same as your output DSN? It's hard for me to follow you.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2051
Location: USA

PostPosted: Wed Jun 21, 2023 10:26 pm
Reply with quote

Kittu1 wrote:
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record

Unless you finally present here the whole and exact copy of your code, plus input data, plus log of execution, plus the results you have REALLY received, - before that time we can hardly help you, and even understand you...
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Jun 22, 2023 12:03 am
Reply with quote

I give it a try. If your input is:
Code:
MJ KI LL    0000001234
MJ KT LL    0000001154
NI KL LL    0000007684

You expect:
Code:
****** ********************
000001 MJ KL LL    0000   
****** ********************

But if you have:
Code:
MJ KI LL    0000001234
MJ KT LL    0000001154
NI KL LL    0000007684
MJ KL LL    4711     

Output should be:
Code:
****** ************************
000001 MJ KI LL    0000001234 
000002 MJ KT LL    0000001154 
000003 NI KL LL    0000007684 
000004 MJ KL LL    4711       
****** ************************
?
Back to top
View user's profile Send private message
Kittu1

New User


Joined: 21 Jun 2023
Posts: 4
Location: India

PostPosted: Thu Jun 22, 2023 10:26 am
Reply with quote

Sorry, I am a student and I am trying to explain the question in the way I know.
The current output looks like this
****** ************************
000001 MJ KI LL 0000001234
000002 MJ KT LL 0000001154
000003 NI KL LL 0000007684
000004 MJ KL LL 4711
****** ************************

But the output i am expecting is
****** ********************
000001 MJ KL LL 0000
****** ********************
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2051
Location: USA

PostPosted: Thu Jun 22, 2023 5:14 pm
Reply with quote

Kittu1 wrote:
Sorry, I am a student and I am trying to explain the question in the way I know.
The current output looks like this
****** ************************
000001 MJ KI LL 0000001234
000002 MJ KT LL 0000001154
000003 NI KL LL 0000007684
000004 MJ KL LL 4711
****** ************************

But the output i am expecting is
****** ********************
000001 MJ KL LL 0000
****** ********************

I repeat again, for the last time:

1) Learn how to use the Code button to present all your data properly

2) Please, demonstrate here ALL of the following
    - your used code, in full
    - your input data, in full
    - the log messages of your test run (100% copied from //SYSOUT DD)
    - your REAL output (100% copied from //SORTOUT DD)

In case you continue to ignore the recommendations, you are condemned to fix your issue by yourself
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
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files and write Matched/Unm... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top