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

Help to Filter File Manager Copybook Output with DFSORT


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

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Feb 28, 2023 12:45 pm
Reply with quote

Hi Team,

Hope you are doing well.

I am trying to flatten the COBOL copybook/layout into a PS file using FILE MANAGER batch program FMNMAIN. Below are the File Manager SYSIN card input:
Code:
$$FILEM SET HEADERPG=YES,PAGESIZE=60
$$FILEM PBK DSNIN=abc.xyz.pqr,
$$FILEM LANG=COBOL,
$$FILEM CBLMAXRC=04,
$$FILEM ARRAY=YES,
$$FILEM MEMLIST=(*),
$$FILEM MEMBER=cpyb187

Below is output from above step..
Code:
Few File Manager program output lines
......
......
......


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2
  Ref Field Name                                                                                    Picture  Type Start
 ----------------------------------------------------------------------------------------------------------------------
    1 1 IN-REC                                                                                                AN      1
    2  2 IN-FIELD1                                                                                            AN      1
    3   3 IN-FIELD1-A                                                                               S9(16)    PD      1
    4   3 IN-FIELD1-B                                                                               X(10)     AN     10
...
...
...
   12  2 IN-FIELD7                                                                                            AN     74
   13   3 IN-FIELD7-A                                                                               9(20)     ZD     74
...
...
  118  2 IN-FIELD38                                                                                           AN    164
  119   3 IN-FIELD38-A                                                                                        AN    164
  120    4 IN-FIELD38-A-AA                                                                          9(6)      ZD    164
...
...


Then I am trying to run DFSORT to extract only COBOL copybook field rows to another PS file. I am trying to check for Non Numeric values from 1 to 5 position and OMIT the rows if they are not equal. I tried below SORT cards

Code:
OMIT COND=(1,5,ZD,NE,NUM)

And
Code:
INREC OVERLAY=(1,5,UFF,M11,LENGTH=5)
OMIT COND=(1,5,ZD,NE,NUM)

But my SORT step is failing with below error
Code:
ICE185A 0 AN S001 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PHASE    0)

Could you please help me where I am doing the mistake in my SORT card? I am unable to find out.

Thanks in advance.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Feb 28, 2023 2:08 pm
Reply with quote

Hi,

Apologies, I have coded SYSOUT=* for SYSIN card accidentally.

I have corrected my job and job is ending with MAX CC 0 now, but, I am getting empty output with below SYSIN Cards
Code:
OMIT COND=(1,5,ZD,NE,NUM)
OPTION COPY

And
Code:
INREC OVERLAY=(1,5,UFF,M11,LENGTH=5)
OMIT COND=(1,5,ZD,NE,NUM)
OPTION COPY


1 to 5 bytes are "Ref" filed, on this data, I am omitting the rows. to get only the copybook fields details to output file.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Feb 28, 2023 4:08 pm
Reply with quote

Hi There,

I am able to get the desired output with below sort card..
Code:
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:1,5)),
      IFTHEN=(WHEN=INIT,FINDREP=(IN=C' ',OUT=C'0',STARTPOS=1,ENDPOS=5))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,5,ZD,EQ,NUM,AND,1,5,ZD,GT,0),
         BUILD=(1:134,5,6:6,128)

Is this the best solution for this required? Please advise

Thanks in advance.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Tue Feb 28, 2023 6:12 pm
Reply with quote

SS - try in OMIT COND to know if 1,5 is any number .
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Tue Feb 28, 2023 6:19 pm
Reply with quote

Code:
 INREC FINDREP=(INOUT=(C' ',C'0'),STARTPOS=1,ENDPOS=5)
 SORT FIELDS=COPY
 OUTFIL INCLUDE=(1,5,ZD,EQ,NUM),
        OVERLAY=(1:1,5,ZD,EDIT=(IIIIT))


You did not show all possible input lines, that's why it remains unclear any potential further simplification.

Another option:
Code:
 INCLUDE COND=(5,1,ZD,EQ,NUM,AND,119,1,ZD,EQ,NUM)
 SORT FIELDS=COPY
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Feb 28, 2023 6:29 pm
Reply with quote

Code:
INCLUDE COND=(1,5,SS,RE,C'^[ ]{0,4}[0-9]{1,5}')
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Tue Feb 28, 2023 6:40 pm
Reply with quote

Joerg.Findeisen wrote:
Code:
INCLUDE COND=(1,5,SS,RE,C'^[ ]{0,4}[0-9]{1,5}')

Rocket science used to hammer nails icon_lol.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Feb 28, 2023 7:00 pm
Reply with quote

Not really. Zero to 4 blanks are allowed, following by 1 to 5 digits. Not perfect, but should be Ok in this case.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Mar 01, 2023 11:20 am
Reply with quote

Hi All,

Thank you so much for all your valuable suggestion on alternate approaches.

Apologies, I couldn't show all possible input lines (those are output of File Manager batch program) due to security restrictions.

I will modify my sort card based on your suggestions.

Thanks again
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Wed Mar 01, 2023 7:14 pm
Reply with quote

satish.ms10 wrote:

Apologies, I couldn't show all possible input lines (those are output of File Manager batch program) due to security restrictions.


Any PII data may be easily masked with XXXXXXXX or whatever else. The real question is: the format of all lines to be processed.

This is a senseless excuse.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Mar 03, 2023 9:50 am
Reply with quote

In case you don't like the RE, use
Code:
INCLUDE COND=(1,5,UFF,GT,+0)
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Mar 03, 2023 5:30 pm
Reply with quote

Joerg.Findeisen wrote:
In case you don't like the RE, use
Code:
INCLUDE COND=(1,5,UFF,GT,+0)


What's if
Code:
ABCD5 . . . . . . . . . . . . . . .
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Mar 03, 2023 7:31 pm
Reply with quote

It is unlikely to happen with this extract, but yes, to be strict, it will produce undesirable results.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Sat Mar 04, 2023 4:38 am
Reply with quote

I insist the best solution (e.g. simple and effective) should be: check 1-byte fields at positions 5 and 119 for NUM.

Simple job requires simple solution, I guess so.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Sat Mar 11, 2023 8:16 pm
Reply with quote

Apologies for the late reply.

I have followed 1-byte NUM value checks solution.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top