def METHOD_NAME():
    params = Params()
    Script.registerArgument(["JobID: DIRAC Job ID"], mandatory=False)
    Script.registerSwitch("u:", "User=", "job owner", params.setUser)
    Script.registerSwitch(
        "S:",
        "Status=",
        f"select job by status (comma separated list of statuses in: {','.join(JOB_STATES)})",
        params.setStatus,
    )
    Script.registerSwitch("a", "StatusAll", "display jobs of any status", params.setStatusAll)
    Script.registerSwitch("g:", "JobGroup=", "select job by job group", params.setJobGroup)
    Script.registerSwitch("n:", "JobName=", "select job by job name", params.setJobName)
    Script.registerSwitch("f:", "Fmt=", "display format (pretty, csv, json)", params.setFmt)
    Script.registerSwitch("D:", "JobDate=", "age of jobs to display (in days)", params.setJobDate)
    Script.registerSwitch(
        "F:",
        "Fields=",
        "display list of job fields (comma separated list of fields. e.g. %s)"
        % ",".join(DEFAULT_DISPLAY_COLUMNS + EXTRA_DISPLAY_COLUMNS),
        params.setFields,
    )
    Script.registerSwitch("i:", "input-file=", "read JobIDs from file", params.setInputFile)
    configCache = ConfigCache()
    Script.parseCommandLine(ignoreErrors=True)
    configCache.cacheConfig()
    args = Script.getPositionalArgs()
    session = DSession()
    params.setSession(session)
    exitCode = 0
    if args:
        # handle comma separated list of JobIDs
        newargs = []
        for arg in args:
            newargs += arg.split(",")
        args = newargs
    jobs = args
    if params.getInputFile() != None:
        with open(params.getInputFile()) as f:
            for l in f.readlines():
                jobs += l.split(",")
    if not jobs:
        # time interval
        jobDate = toString(datetime.datetime.utcnow().date() - params.getJobDate() * day)
        # job owner
        userName = params.getUser()
        if userName is None:
            result = session.getUserName()
            if result["OK"]:
                userName = result["Value"]
        elif userName == "*" or userName.lower() == "__all__":
            # jobs from all users
            userName = None
        result = selectJobs(
            owner=userName,
            date=jobDate,
            jobGroup=params.getJobGroup(),
            jobName=params.getJobName(),
        )
        if not result["OK"]:
            gLogger.error(result["Message"])
            DIRACExit(-1)
        jobs = result["Value"]
    try:
        jobs = [int(job) for job in jobs]
    except Exception as x:
        gLogger.error("Expected integer for jobID")
        exitCode = 2
        DIRACExit(exitCode)
    summaries = {}
    statuses = params.getStatus()
    # split summary requests in chunks of a reasonable size (saves memory)
    for chunk in chunks(jobs, 1000):
        result = getJobSummary(chunk)
        if not result["OK"]:
            gLogger.error(result["Message"])
            DIRACExit(2)
        # filter on job statuses
        if "all" in statuses:
            summaries = result["Value"]
        else:
            for j in result["Value"]:
                if result["Value"][j]["Status"].lower() in statuses:
                    summaries[j] = result["Value"][j]
    for s in summaries.values():
        s["JobID"] = int(s["JobID"])
    af = ArrayFormatter(params.getFmt())
    gLogger.notice(af.dictFormat(summaries, ["JobID"] + params.getFields(), sort="JobID"))
    DIRACExit(exitCode)